my problem is that how can we intialize a string using cin in output console like this.
My class is very good through cin...as the spaces put the null character so only first alphabet is initialized....kindly someone give me solution..
D:\Program Files\Microsoft Visual Studio\MyProjects\cin character string\b.cpp(11) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::alloc
ator<char> >' (or there is no acceptable conversion)
Error executing cl.exe.
Here is a more complete and compilable program snippet
int main(int arc, char* argv)
if( argc > 1)
input = argv; // get string from command-line argument
std::cin >> input; // get string from keyboard or from stdin
argc is the number of command-line arguments plus the name of the program. On most platforms the value of argc is at least 1. argv is an array of strings that represent each of the command line arguments. argv is the name of the program.
So, if the name of the program is myprog.exe and you execute it like this on the command line myprog one two three
The value of argc will be 4.
argv == "myprog.exe" (sometimes it includes the full path)
argv == "one"
argv == "two"
argv == "three"