Refer to EXAMPLE 3-7 in P. 137 of D.S. Malik - C++ Programming. Program Design including Data Structures book, assume th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Refer to EXAMPLE 3-7 in P. 137 of D.S. Malik - C++ Programming. Program Design including Data Structures book, assume th

Post by answerhappygod »

Refer To Example 3 7 In P 137 Of D S Malik C Programming Program Design Including Data Structures Book Assume Th 1
Refer To Example 3 7 In P 137 Of D S Malik C Programming Program Design Including Data Structures Book Assume Th 1 (33.94 KiB) Viewed 57 times
Refer To Example 3 7 In P 137 Of D S Malik C Programming Program Design Including Data Structures Book Assume Th 2
Refer To Example 3 7 In P 137 Of D S Malik C Programming Program Design Including Data Structures Book Assume Th 2 (35.97 KiB) Viewed 57 times
Refer to EXAMPLE 3-7 in P. 137 of D.S. Malik - C++ Programming. Program Design including Data Structures book, assume the user entered abcd in line 6. //Functions peek and putback #include <iostream> using namespace std; int main() ( char chi } cout << "Line 6: Enter a string: "; cin.get (ch); cout << endl; cout << "Line 9: After first cin.get (ch); << "ch = " << ch << endl; cin.get (ch); cout << "Line 11: After second cin.get (ch); . << "ch= " << ch << endl; cin.putback (ch); cin.get (ch); cout << "Line 14: After putback and then. 138 Chapter 3: Input/Output << "cin.get (ch); ch= << ch << endl; chcin.peek (); cout << "Line 16: After cin.peek(); ch= << ch << endl; cin.get (ch); cout << "Line 18: After cin.get (ch); ch= . << ch << endl; return 0; //Line 1 //Line 2 //Line 3 //Line 4 //Line 5 //Line 6 //Line 7 //Line 8 //Line 9 //Line 10 //Line 11 //Line 12 //Line 13 //Line 14 //Line 15 //Line 16 //Line 17 //Line 18 //Line 19 //Line 20 Assume the input is abcd. 1. Explain what is peek() and putback(). 10 points
using namespace std; int main(). { char ch; } cout << "Line 6: Enter a string: "; cin.get (ch); cout << endl; cout << "Line 9: After first cin.get (ch); << "ch = " << ch << endl; cin.get (ch); cout << "Line 11: After second cin.get (ch); . << "ch = " << ch << endl; cin.putback (ch); cin.get (ch); cout << "Line 14: After putback and then " 138 Chapter 3: Input/Output << "cin.get (ch); ch = " << ch << endl; ch = cin.peek(); cout << "Line 16: After cin.peek(); ch = " << ch << endl; cin.get (ch); cout << "Line 18: After cin.get (ch); ch = " <<ch << endl; return 0; Assume the input is abcd. 1. Explain what is peek() and putback(). points //Line 2 //Line 3 //Line 4 //Line 5 //Line 6 //Line 7 //Line 8 //Line 9 //Line 10 //Line 11 //Line 12 //Line 13 //Line 14 //Line 15 //Line 16 //Line 17 //Line 18 //Line 19 //Line 20 2. Explain what is the result of each step for the screenshot above. 10 points
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply