The following code DOES NOT STOP to request the value for lname or ID. What line of code could you include to ensure the user can enter the requested integer and line of text? Modify the code below. Place the line of code in the correct place to fix the problem. Note: remember the file read pointer. int choice; string lname, Id; cout << “Welcome to the student record search system” << endl; cout << "Please enter 1 to search by last name or 2 to search by ID " << endl; cin >> choice; if (choice == 1) { cout << “Please enter the last name “ << endl; getline(cin, lname); } else { cout << "Please enter the ID “ << endl; getline(cin, Id); }
The following code DOES NOT STOP to request the value for lname or ID. What line of code could you include to ensure the user can enter the requested integer and line of text? Modify the code below. Place the line of code in the correct place to fix the problem. Note: remember the file read pointer. int choice; string lname, Id; cout << “Welcome to the student record search system” << endl; cout << "Please enter 1 to search by last name or 2 to search by ID " << endl; cin >> choice; if (choice == 1) { cout << “Please enter the last name “ << endl; getline(cin, lname); } else { cout << "Please enter the ID “ << endl; getline(cin, Id); }
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter8: Arrays
Section: Chapter Questions
Problem 7E
Related questions
Question
- The following code DOES NOT STOP to request the value for lname or ID. What line of code could you include to ensure the user can enter the requested integer and line of text? Modify the code below. Place the line of code in the correct place to fix the problem. Note: remember the file read pointer.
int choice;
string lname, Id;
cout << “Welcome to the student record search system” << endl;
cout << "Please enter 1 to search by last name or 2 to search by ID " << endl;
cin >> choice;
if (choice == 1)
{
cout << “Please enter the last name “ << endl;
getline(cin, lname);
}
else
{
cout << "Please enter the ID “ << endl;
getline(cin, Id);
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr