1.
What will be displayed on the screen from the following statements?
#include
#include
usingnamespacestd;
intmain()
{
intx = 15;//Line 1
inty = 7634;//Line 2
cout //Line 3
cout "12345678901234567890"//Line 4
cout '@')
'#')
'^') "Warm"
//Line 5
return0;
}
Display:
2.
Consider the declaration:
char ch1, ch2;
and the input:
Hello there. My name is Micky.
a)
Consider the following statements, after executing them, the result for ch1 is_______, for ch2 is _______
cin>>ch1;
cin.ignore(100, ‘.’);
cin>>ch2;
b)
Consider the following statements, after executing them, the result for ch1 is_______, for ch2 is _______
cin>>ch1;
cin.ignore(10, ‘*’);
cin>>ch2;
3.
Write a C++ program that calculate, here a=1, b=2 and c=0.5. Input a, b , and c; output a, b, c, and x, set precision as two decimals.
1.
Suppose thatageis anintvariable,chis acharvariable, andnameis astringvariable. What are the values ofageandnameafter the following input statements execute:
cin>>age;
cin.get(ch);
getline(cin, name);
if the input is:
agename
a.23 Lance Grant;______________
b.23
Lance Grant______________
2.
True or False
a.To use the manipulatorssetprecision, setw, andsetfill, the program must include the header fileiostream.
b.
The manipulatorsetwformats the output of an expression in a specific number of columns; the default output is right-justified.
c.coutis correct on c++ programming syntax.
d.The functionclearis used to skip certain input in a line.