a).#include
#include
using namespace std;
class phone {
char name[40];
char nur[14];
public:
void store(char *n, char *num);
void show();
};
void phone::store(char *n, char *num) {
strcpy(name, n);
strcpy(number, num);
id phone::show()
{
cout <cout << "\n";
}
int main()
{
phone *p;
p = new phone;
if(!p) {
cout << "Allocation error.";
n 1;
}
p->store("Isaac Newton", "111 555-2323");
p->show();
delete p;
return 0;
}
b).On failure, new will either return a null pointer or generate an exception.You must check you compiler's documentation to determine which approach is used. In standard C++, new generates an exception by default
Githiari answered the question on May 31, 2018 at 17:12
- 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. Answers (1)
- 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. Answers (1)
- 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. Answers (1)
- Explain the advantages of a computer network?(Solved)
Explain the advantages of a computer network?
Date posted: May 16, 2018. Answers (1)
- Explain types of malware in computer protection(Solved)
Explain types of malware in computer protection.
Date posted: May 16, 2018. Answers (1)
- What is a malware in computer protection?(Solved)
What is a malware in computer protection?
Date posted: May 16, 2018. Answers (1)
- Explain how to set password for Microsoft Excel Workbook?(Solved)
based on Microsoft Excel Workbook
Date posted: May 16, 2018. Answers (1)
- 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. Answers (1)
- 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. Answers (1)
- Giving examples explain dual booting in computers?(Solved)
Giving examples explain dual booting in computers?
Date posted: May 15, 2018. Answers (1)
- 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. Answers (1)
- 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. Answers (1)
- 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. Answers (1)
- 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. Answers (1)
- Printers can receive 3 different types of data. Briefly Explain.(Solved)
Printers can receive 3 different types of data. Briefly Explain.
Date posted: May 11, 2018. Answers (1)
- Word Processing, Graphic Design and Desktop Publishing are related. Discuss these terms as used in computer aided design clearly showing their differences. (Solved)
Word Processing, Graphic Design and Desktop Publishing are related. Discuss these terms as used in computer aided design clearly showing their differences.
Date posted: May 11, 2018. Answers (1)
- Mr Isaac Muthini is a system Analyst at Code Labs Services, outline four responsibilities that should carry out in the Firm(Solved)
Mr Isaac Muthini is a system Analyst at Code Labs Services, outline four responsibilities that should carry out in the firm.
Date posted: May 10, 2018. Answers (1)
- Explain the difference between the dynamic RAM and static RAM(Solved)
Explain the difference between the dynamic RAM and static RAM.
Date posted: May 10, 2018. Answers (1)
- Expand and Express 622 base 10 in BCD form(Solved)
Expand and Express 622 base 10 in BCD form.
Date posted: May 10, 2018. Answers (1)
- Web Design is not simply collecting data and uploading but rather a process”. Using relevant illustrations, justify the validity of this statement. (Solved)
Web Design is not simply collecting data and uploading but rather a process”. Using relevant illustrations, justify the validity of this statement.
Date posted: May 9, 2018. Answers (1)