What is the header of cin and cout
// #include
How to display string of binary 10 digit value 7 in decimal
std: :bitset<10> value(7);
std: :cout «_space;value;
What std function to read one line of string from input stream?
std::getline
Ex:
std::string input;
std::getline(cin, input);
What is the simple way to read input data until end of file?
string input_data;
while ( !cin.eof() ) {
getline( cin, input_data);
}
How to tell cout to display true or false instead of 0 or 1?
cout «_space;boolalpha;
Show how to use stringstream for input stream.
#include
...
stringstream sin( "123456\n"
"xxxyes\n"
)
string line;
getline(sin, line);How to display double in two decimal precision
cout «_space;std::fixed «_space;setprecision(2); «_space;value;