bartleby

Concept explainers

Question
Book Icon
Chapter 18, Problem 4P
Program Plan Intro

Student Enrollment

Program Plan:

  • Include required header file.
  • Include required “std” namespace.
  • Define main function.
    • Declare variable for student ID and course number.
    • Map the student ID to a vector of “string” using “map” and “vector” template class.
    • Create constant iterator in “map” template class.
    • Read the student ID from user.
    • Performs “while” loop. This loop will execute until the student is equal to “-1”.
      • Read course number from user.
      • Check condition. If the student ID in list is equal to student list end, then
        • Declare a “vector” variable to “courseList”.
        • Push the course number into course list using “push_back” function.
        • Insert the pair value into student list.
      • Otherwise
        • Declare a “vector” variable to “courseList”.
        • Find the student ID in student list and then store it in a variable “iterList”.
        • Push the course number into course list.
        • Erase the student ID from student list.
      • Read the student ID from user.
    • Display respective statement.
    • Display student ID and its corresponding course numbers.

Blurred answer
Students have asked these similar questions
Write in Python: A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes in word pairs that consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Assume the search name is always in the list. Ex: If the input is: Joe,123-5432 Linda,983-4123 Frank,867-5309 Frank the output is: 867-5309
A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Ex: If the input is: 3 Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is: 867-5309 Your program must define and call the following function. The return value of GetPhoneNumber is the phone number associated with the specific contact name.string GetPhoneNumber(vector<string> nameVec, vector<string> phoneNumberVec, string contactName) #include <iostream>#include <vector>using namespace std; string GetPhoneNumber(vector<string> nameVec, vector<string> phoneNumberVec, string contactName) {} int main()…
A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output "None" if name is not found. Ex: If the input is: 3 Joe,123-5432 Linda,983-4123 Frank,867-5309 Frank the output is: 867-5309 Your program must define and call the following function. The return value of GetPhoneNumber is the phone number associated with the specific contact name.string GetPhoneNumber(vector<string> nameVec, vector<string> phoneNumberVec, string contactName) Hint: Use two vectors: One for the string names, and the other for the string phone numbers.
Knowledge Booster
Background pattern image
Computer Science
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.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT