Super noob question, but i don't fully understanding what is being asked here.

I'm taking my first programming class in C++ and am having a hard time understanding exactly what is being asked in my first assignment. Could someone please clarify what is being asked? From what I understand it is asking me to start a simple process with the int(main), then enter the cout statements provided below. I'm not sure what it's asking when it says to write a statement to output the information because i thought that's what cout did. Obviously I can't ask for an answer, but could someone please point me in the right direction on what is being asked by that?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 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.
 
             int main()
             {
                 return 0;
             }
 
 Inside those curly brackets and before the return statement you will be typing lots of cout statements to print out information. There us no input for this problem.
 
 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 1) the .cpp file with both the code and the output shown as a comment at the bottom, and 2) the .txt file showing the output only.
Last edited on
For each statement you'll have to declare a variable of the appropriate type, std::cin info into that variable and then std::cout that info again
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>
using namespace std;

void function();

int main()
{

	string name, email, major;
	cout << "Enter your name: ";
	getline(cin, name);
	cout << "Enter your email: ";
	getline(cin, email);
	cout << "Enter your major: ";
	getline(cin, major);

	cout << "Computer Experience: ";
	cout << "\n" << name << endl << email << endl << major;

	system("PAUSE");
	return 0;
}
Last edited on
Ah that makes sense. That you two for your quick and helpful responses.
There us no input for this problem.

Try instead:
1
2
3
4
5
6
7
8
9
# include <iostream>
using std::cout;
int main() {
  cout <<“NAME:\t”; cout << "Baconator\n";
  cout <<“E-MAIL:\t”; cout << "baconator@whatever.com\n";
  cout <<”MAJOR:\t”; cout << "CS\n";
  cout << “COMPUTER EXPERIENCE:\t”; cout << "Programming God\n";
  return 0;
}
Last edited on
Even operator << sends input to the stream, the problem might have meant w/o declaring any additional variables but that was not stated
Topic archived. No new replies allowed.