Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following input in the input stream, what would be stored in the variables after the following code executes. // Input stream : ab1%2Yu9
Given the following input in the input stream, what would be stored in the variables after the following code executes.
// Input stream : ab1%2Yu9
char ch;
cin.get(ch);
cout << "#Output 1 " << ch << endl;
cin.ignore(5, '%');
ch = cin.peek();
cout << "#Output 2 " << ch << endl;
cin.get(ch);
cin.putback(ch);
cin.get(ch); cout << "#Output 3 " << ch << endl; cin.get(ch); cout << "#Output 4 " << ch << endl;
system("pause");
return 0;
#Output 1 =
#Output 2 =
#Output 3 =
#Output 4 =
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started