Question #58456

. Write declaration statements to store the string of characters “Input
theƒFollowingƒData” in a character array named message1, the string “------------” in
an array named message2, the string “EnterƒtheƒDate:” in an array named message3, and
the string “EnterƒtheƒAccountƒNumber:” in an array named message4.
b. Include the array declarations written in Exercise 7a in a program that uses a cout statement to display the messages. For example, the statement coutƒ<<ƒmessage1; causes the
string stored in the message1 array to be displayed. Your program requires four of these
statements to display the four messages. Using a cout statement to display a string requires
placing the end-of-string marker \0 in the character array used to store the string.
1

Expert's answer

2016-03-18T15:48:05-0400

Answer on Question #58456 - Programming & Computer Science / C++

Question

a) Write declaration statements to store the string of characters. "Input the Following Data" in a character array named message1, the string "---" in an array named message2, the string "Enter the Date:" in an array named message3, and the string "Enter the Account Number:" in an array named message4.

b) Include the array declarations written in Exercise 7a in a program that uses a cout statement to display the messages. For example, the statement cout << message1; causes the string stored in the message1 array to be displayed. Your program requires four of these statements to display the four messages. Using a cout statement to display a string requires placing the end-of-string marker \0 in the character array used to store the string.

Solution

#include <iostream>
using namespace std;
int main(int argc, char **argv) {
char message1[] = "Input the Following Data";
char message2[] = "---";
char message3[] = "Enter the Date:";
char message4[] = "Enter the Account Number:";
cout << message1 << endl;
cout << message2 << endl;
cout << message3 << endl;
cout << message4 << endl;
return 0;
}


http://www.AssignmentExpert.com/</iostream>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS