This should have been my second post, but I idiotically posted up source code of a "complicated" application for new learners. This post will be about basic input and output in c++. here would be an example of a Hello program:
program. In the next tutorial we will be covering the use of variables.
- Code:
#includes <iostream>
using namespace std;//this is for the cin and cout functions
int main()
{
char x[128];//edited 10:04 am 8/22/2012
cout << "What is your name?" << endl;//this is the output
cin >> x;//this is the input
cout << "Hello " << x << "!" << endl; //this is the result
system("PAUSE");//this lets you review the result
return 0;// returns positive if it completes
}