Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
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
IN JS PROGRAMMING LANGUAGE Your local bank has decided to upgrade its ATM machines by incorporating motion sensor technology. The machines now interpret a series of consecutive dance moves in place of a PIN number. Create a program that converts a customer's PIN number to its dance equivalent. There is one dance move per digit in the PIN number. A list of dance moves is given in the code. Examples danceConvert("0000") danceConvert("3856") ["Shimmy", "Shake", "Pirouette", "Slide"] → ["Slide", "Arabesque", "Pop", "Arabesque" ] -
In C Programming Language Palindrome: “A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward, such as ‘madam’ or ‘kayak’” (excerpt from Wikipedia).Write a program that reads 8 words from Palindrome.txt and checks whether the word you read is a palindrome (please read its description above) or not. Print the index numbers of all the palindrome words in your array. You are required to read words character by character into a character array.• Write readFile function, which gets a file pointer and a two-dim array, to read each word(bunch of characters) line by line and store them into a two-dim character array.• Write findSize function takes a one-dim array and returns its actual size.• Write isPalindrome function takes a one-dim character array to check whether the content is a polindrome or not. If the word (character squence) is a palindrome, then it returns 1. Otherwise, it returns 0.
Given the code that reads a list of integers, complete the number_guess() function, which should choose a random number between 1 and 100 by calling random.randint() and then output if the guessed number is too low, too high, or correct. Import the random module to use the random.seed() and random.randint() functions. • random.seed(seed value) seeds the random number generator using the given seed value. • random.randint(a, b) returns a random number between a and b (inclusive). For testing purposes, use the seed value 900, which will cause the computer to choose the same random number every time the program runs.
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