I am new to c++, I just start to learn programming from yesterday, and I already stuck at a very simple task.
I want to write a program to read a single word from the console and print that word back to the console. I wrote this code, it work but it also print a "0" at the end. I want the program only prints that word to the console with no additional output. How can I do this? pls help me
And sorry for my bad Englsh, I am not a native English speaker.
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
usingnamespace std;
int main ()
{
int i;
cin >> i;
cout << i;
return 0;
}
A fundamental thing to understand in C++ programming is the concept of types. An int type represents an integer number (-1, 0, 1, 2, 3, ...). A word cannot be stored in an integer. You should use a string type for that. "Strings" are groups of characters in programming terminology.