Get premium membership and access questions with answers, video lessons as well as revision papers.
- Given the following class definition,
class test{
char *p;
int *q;
int count;
public:
test(char *x, int *y, int c) {
p = x;
q = y;
count = c;
}
//...
};
Is it possible...(Solved)
Given the following class definition,
class test{
char *p;
int *q;
int count;
public:
test(char *x, int *y, int c) {
p = x;
q = y;
count = c;
}
//...
};
Is it possible to dynamically allocate an array of these objects?
Date posted: May 31, 2018.
- Given the following partial class, add the necessary constructor function so that both declarations within main() are valid.
class samp {
int a;
public:
//add constructor functions
int get_a() {...(Solved)
Given the following partial class, add the necessary constructor function so that both declarations within main() are valid.
class samp {
int a;
public:
//add constructor functions
int get_a() { return a;}
};
int main()
{
samp ob(88); //init ob's a to 88
samp obarray[10]; //nonitialized 10-element array
// ...
}
Date posted: May 31, 2018.
- a)Show how to overload the constructor for the following class so that unitialized objects can also be created. (When creating uninitialized objects, give x and...(Solved)
a)Show how to overload the constructor for the following class so that unitialized objects can also be created. (When creating uninitialized objects, give x and y the value 0.)
class myclass {
int x, y;
public:
myclass(int i, int j) { x=i; y=j;}
// ...
};
b)Using the class from question(a) above, show how you can avoid overload myclass() by using default arguments.
Date posted: May 31, 2018.
- Why would the following be an inappropriate use of an overloaded operator?coord coord:: operator%(coord ob) {double i;cout << "Enter a number:";cin >>i;cout << "root of...(Solved)
Why would the following be an inappropriate use of an overloaded operator?
coord coord:: operator%(coord ob)
{
double i;
cout << "Enter a number:";
cin >>i;
cout << "root of " << i << "is ";
cout << ();
}
Date posted: May 31, 2018.
- Relative to coord, overload the * and / operators. Demonstrate that they work.
(Solved)
Relative to coord, overload the * and / operators. Demonstrate that they work.
Date posted: May 31, 2018.
- Given the following class, show how to add a friend function called isneg() that takes one parameter of type myclass and returns true if num...(Solved)
Given the following class, show how to add a friend function called isneg() that takes one parameter of type myclass and returns true if num is negative and false otherwise.
class myclass {
int num;
public:
myclass(int x) {num = x;}
};
Date posted: May 31, 2018.
- Given the following class,
class summation{
int num;
long sum; //summation of num
public:
void set_sum(int n);
void show_sum () {
cout <(Solved)
Given the following class,
class summation{
int num;
long sum; //summation of num
public:
void set_sum(int n);
void show_sum () {
cout <
Date posted: May 31, 2018.
- What is wrong with the following prototype, which uses a default argument?int f(int count, int max = count);(Solved)
What is wrong with the following prototype, which uses a default argument?
int f(int count, int max = count);
Date posted: May 31, 2018.
- Most C++ compilers supply nonstandard functions that allow cursor positioning and the like. If a compiler supplies such functions, create a function called myclreol() using...(Solved)
Most C++ compilers supply nonstandard functions that allow cursor positioning and the like. If a compiler supplies such functions, create a function called myclreol() using C++ language a function that clears the line from the current cursor position to the end of the line. However, give this function a parameter that specifies the number of character position to clear. If the parameter is not specified, automatically clear the entire line. Otherwise, clear only the number of character positions specified by the parameter.
Date posted: May 31, 2018.
- In the C++ standard library is the function strtol(), which has this prototype:
long strtol|(const char*start, const **end, int base);
The function cnverts the numeric string...(Solved)
In the C++ standard library is the function strtol(), which has this prototype:
long strtol|(const char*start, const **end, int base);
The function cnverts the numeric string pointed to by start into a long integer. The number base of the numeric string is specified by base. Upon return, end points to the character in the string immediately following the end of the number. The long integer equivalent of the numeric string is returned. base must be in the range 2 to 38. However, most commonly, base 10 is used.
Create a function called mystrtol() that works the same as strtol() except that base is given the default argument of 10. Demonstrate that your version works correctly.
Date posted: May 31, 2018.
- Using the following class declaration, create a ten-element array, initialize num to the values 1 through 10, and itialize sqr to num's square.
#include
using namespace...(Solved)
Using the following class declaration, create a ten-element array, initialize num to the values 1 through 10, and itialize sqr to num's square.
#include
using namespace std;
class square {
int num, sqr;
public:
square (int a, int b) {num=a; sqr=b;}
voshow() {cout <
Date posted: May 31, 2018.
- Using the following class declaration, create a ten-elment array and initialize the ch element with the values A through J. Demonstrate that the array does,...(Solved)
Using the following class declaration, create a ten-elment array and initialize the ch element with the values A through J. Demonstrate that the array does, indeed, contains these value.
#include
using namespace std;
class letters {
char ch;
public:
letters (char c) { ch = c; }
char get_c) { return ch;}
};
Date posted: May 31, 2018.
- Write a C++ program that uses new to dynamically allocate a float, a long, and char.Give these dynamic variable values and display their values. Finally, release...(Solved)
Write a C++ program that uses new to dynamically allocate a float, a long, and char.Give these dynamic variable values and display their values. Finally, release all dynamically allocated memory by using delete.
Date posted: May 31, 2018.
- Given the following program, convert all appropriate references to class members to explicit this pointer references.
#include
using namespace std;
class myclass {
int a, b;
public:
myclass(int n, int...(Solved)
Given the following program, convert all appropriate references to class members to explicit this pointer references.
#include
using namespace std;
class myclass {
int a, b;
public:
myclass(int n, int m,) {a=n; b=m;}
int add() {return a+b; }
void show();
};
void myclass::show()
{
t = add(); //call member function
cout <
Date posted: May 31, 2018.
- a) Show how to convert the following code into its equivalent that uses new.
char *p;
p= (char *) malloc(100);
//...
strcpy(p, "This is a test");
b)Using new, show how...(Solved)
a) Show how to convert the following code into its equivalent that uses new.
char *p;
p= (char *) malloc(100);
//...
strcpy(p, "This is a test");
b)Using new, show how to allocate a double and give it an initial value of -123.0987
Date posted: May 31, 2018.
- a)Create a class that contains a person's name and telephone number. Using new, dynamically allocate an object of this class and put your name and...(Solved)
a)Create a class that contains a person's name and telephone number. Using new, dynamically allocate an object of this class and put your name and phone number into these fields within this object.
b).What are the two ways that new might indicate an allocatn failure?
Date posted: May 31, 2018.
- What is wrong with following program?
// This program has an error.
#include
using namespace std;
void triple(double &num);
int main()
{
double d = 7.0;
tripe(&d);
cout << d;
return 0;
}
//...(Solved)
What is wrong with following program?
// This program has an error.
#include
using namespace std;
void triple(double &num);
int main()
{
double d = 7.0;
tripe(&d);
cout << d;
return 0;
}
// Triple num's value.
void triple(double &num)
{
num = 3 * num;
}
Date posted: May 31, 2018.
- Write a C++ function called neg() that reverses the sign of its integer parameter.Write the function two ways-first by using a pointer parameter and then...(Solved)
Write a C++ function called neg() that reverses the sign of its integer parameter.Write the function two ways-first by using a pointer parameter and then by using a reference parameter.Include a short program to demonstrate their operation.
Date posted: May 31, 2018.
- List and explain four editing features found in word processor
(Solved)
List and explain four editing features found in word processor
Date posted: May 23, 2018.
- Explain the advantages of a computer network?(Solved)
Explain the advantages of a computer network?
Date posted: May 16, 2018.
- Explain types of malware in computer protection(Solved)
Explain types of malware in computer protection.
Date posted: May 16, 2018.
- What is a malware in computer protection?(Solved)
What is a malware in computer protection?
Date posted: May 16, 2018.
- Explain how to set password for Microsoft Excel Workbook?(Solved)
based on Microsoft Excel Workbook
Date posted: May 16, 2018.
- Explain how to set a password for a Microsoft word document?(Solved)
Explain how to set a password for a Microsoft word document?
Date posted: May 16, 2018.
- Explain how to recover and empty files from the computer recycle bin?(Solved)
Explain how to recover and empty files from the computer recycle bin?
Date posted: May 15, 2018.
- Giving examples explain dual booting in computers?(Solved)
Giving examples explain dual booting in computers?
Date posted: May 15, 2018.
- Explain how to clean temporary files and history with free software for windows?(Solved)
Explain how to clean temporary files and history with free software for windows?
Date posted: May 15, 2018.
- Define the following terms as they are used in Desktop publishing and graphic design.
a. WYSIWYG
b. RGB
c. LOGO
d. BLEED
e. ZOOM
f.RMM...(Solved)
Define the following terms as they are used in Desktop publishing and graphic design.
a. WYSIWYG
b. RGB
c. LOGO
d. BLEED
e. ZOOM
f.RMM (with reference to memory).
g.EBCDIC
Date posted: May 11, 2018.
- Name at least five Objects you can insert in a word document using Insert TAB.(Solved)
Name at least five Objects you can insert in a word document using Insert TAB.
Date posted: May 11, 2018.
- Contrast and proximity are exemplified as the principles of design most useful to a desktop publisher. How are they applied? (Solved)
Contrast and proximity are exemplified as the principles of design most useful to a desktop publisher. How are they applied?
Date posted: May 11, 2018.