147k views
5 votes
The problem you are solving is as follows : This program is going to have just one function. Its name will be main. In fact every program in ‘C++’ will have a function called main. The computer needs to know where the execution starts. You need more "components" on top of the program to make it work. (Hint: see the "hello world" example in Module-1C to find out what is missing) int main() { return 0; } Inside those curly brackets and before the return statement you will be typing lots of print statements. cout << "NAME:\t"; cout << "E-MAIL:\t"; cout << "MAJOR:\t"; cout << "COMPUTER EXPERIENCE:\t"; After each of the cout statements given above, write another statement to output the information. So you will have at least eight statements in all. You will submit: the .cpp file with both the code and the output shown as a comment at the bottom, and the .txt file showing the output only, i.e. copy the output from the console and then paste to a .txt file. See instructions in Appendix III of Module 1. Here is a sample of the output and it should look at least like this on the console window:

1 Answer

2 votes

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. cout<<"NAME:\t";
  6. cout<<"James\\";
  7. cout<<"E-MAIL:\t";
  8. cout<<"James_email_domain\\";
  9. cout << "MAJOR:\t";
  10. cout <<"Computer Science\\";
  11. cout << "COMPUTER EXPERIENCE:\t";
  12. cout <<"Three years of C++ Programming\\";
  13. return 0;
  14. }

Step-by-step explanation:

In C++, we can use cout as the output stream to print value to console terminal. In this question, we can write another four statements to display the name, email, major and computer experiences to console terminal using cout (Line 8, 10, 12, 14). The \\ in each cout statement is an escape sequence to print a new line. This will prevent the subsequent line of string joined with the previous line that would affect readability of the output.

User Danvil
by
4.5k points