Chapter 3.8- Working With Characters and String objects C++
Given a string variable word, write a string expression that parenthesizes the value of word. So, if word contains "sadly", the value of the expression would be the string "(sadly)"
"(" + word + ")"
Given a string variable address, write a string expression consisting of the string "http://" concatenated with the variable 's string value . So, if the value of the variable were "www.turingscraft.com", the value of the expression would be "http://www.turingscraft.com".
"http://" + address
A variable c of type char has been declared . Write the necessary code to read in the next character from standard input and store it in c, regardless of whether is a whitespace character .
cin.get(c);
Assume that a,b and c are char variables have been declared . Write some code that reads in the first character of the next line into a, the first character of the line after that into b and the first character of the line after that into c. Assume that the lines of input are under 100 characters long.
cin.ignore(100, '\n') >> a; cin.ignore(100, '\n') >> b; cin.ignore(100, '\n') >> c;
Assume that c is a char variable has been declared . Write some code that reads in the first character of the next line into c. Assume that the lines of input are under 100 characters long.
cin.ignore(100, '\n') >> c;
Write an expression that concatenates the string variable suffix onto the end of the string variable prefix .
prefix + suffix
Declare a string named line and write a statement that reads in the next line of standard input into this variable .
string line; getline(cin, line);