|
-
January 7th, 2002, 09:38 PM
#5
Junior Member
C++ tutorial expansion.. Input
Ok, since you should have a basic understanding of Outpu, and got bored with it by now. I will go over basic input.
Bare with me here, I'm busying learning this language and TCP/IP ( and learning more about linux )..
Ok
I gope you remember the comment "//" "/* .... */" . If not look back on them.
#include <iostream.h> // don't worry about this yet.
int main() // or this, lol
{ // opening brace
int a; // our variable that we shall use
cout << " Enter a number to be shown on the screen : \t";
/* the "\t" means TAB, just like "\n" means new line */
cin >> a; // this ask for input by you, to set the value of a
/* notic the differenc between the cout "<<" and the cin ">>", << directs the message to output, and >> recieves the input by you. If i'm wrong onthis please correct me. But it isn't that important as long as you keep them right, and not mix them up */
cout << a << endl; // outputs the value of a
return 0;
} // end of program
remember to end all statements with a semi-colon " ; "
Now I will write the code out with no comments.
#include <iostream.h>
int main()
{
int a;
cout << "Enter a number to be shown on the screen : \t";
cin >> a;
cout << a << endl;
return 0;
}
ok well maybe this will help you all. I must go back to my learning now. If you all would still like some more tutorials, reply.
And remmeber, anyone can add on to this.
Later
MR
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|