1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Firlakuza [10]
2 years ago
12

Write a C++ program that creates a map containing course numbers and the room numbers of the rooms where the courses meet. The d

ictionary should have the following key-value pairs:
Course Number (key) Room Number (value)
CS101 3004
CS102 4501

The program should also create a map containing course numbers and the names of the instructors that teach each course. The map should have the following key-value pairs:

Course Number (key) Instructor (value)
CS101 Haynes
CS102 Alvarado

The program should also create a map containing course numbers and the meeting times of each course. The map should have the following key-value pairs:

Course Number (key) Meeting Time (value)
CS101 8:00am
CS102 9:00am

The program should let the user enter a course number, and then it should display the course's room number, instructor, and meeting time.
Computers and Technology
1 answer:
swat322 years ago
7 0

Answer:

Program approach:-

  • Using the necessary header file.
  • Using the standard namespace I/O.
  • Define the integer main function.
  • Mapping course numbers and room numbers.

Explanation:

//header file

#include<iostream>

#include<map>

//using namespace

using namespace std;

//main function

int main(){

               //creating 3 required maps

               map <string,int> rooms;

               map <string,string> instructors;

               map <string,string> times;

               //mapping course numbers and room numbers

               rooms.insert(pair<string,int>("CS101",3004));

               rooms.insert(pair<string,int>("CS102",4501));

               //mapping course numbers and instructor names

               instructors.insert(pair<string,string>("CS101","Haynes"));

               instructors.insert(pair<string,string>("CS102","Alvarado"));

               //mapping course numbers and meeting times

               times.insert(pair<string,string>("CS101","8:00am"));

               times.insert(pair<string,string>("CS102","9:00am"));

               

               char choice='y';

               //looping until user wishes to quit

               while(choice=='y' || choice=='Y'){

                               cout<<"Enter a course number: ";

                               string course;

                               cin>>course;//getting course number

                               //searching in maps for the required course number will return

                               //an iterator

                               map<string, int>::iterator it1=rooms.find(course);

                               map<string, string>::iterator it2=instructors.find(course);

                               map<string, string>::iterator it3=times.find(course);

               

                               if(it1!=rooms.end()){

                                               //found

                                               cout<<"Room: "<<it1->second<<endl;

                               }else{

                                               //not found

                                               cout<<"Not found"<<endl;

                               }

               

                               if(it2!=instructors.end()){

                                               cout<<"Instructor: "<<it2->second<<endl;

                               }

               

                               if(it3!=times.end()){

                                               cout<<"Meeting Time: "<<it3->second<<endl;

                               }

                               //prompting again

                               cout<<"\nDo you want to search again? (y/n): ";

                               cin>>choice;

               }

You might be interested in
Continuous data
Elena-2011 [213]

Answer: Could be subdivided into smaller and smaller units.

Explanation:

 The continuous data are basically measured in the small units and can be easily subdivided into smaller parts without changing their actual meaning.

The continuous data also contain numeric value and can be divided into smaller and finer meaningful parts.

The continuous data can be measured according to the precision of the system. The size and volume are the example of the continuous data.

7 0
3 years ago
Why do we need multitasking functionality in an Operating System?
Leokris [45]

Answer:

Multitasking is a process in which we do multiple task at a time.    

In computing system, multitasking is the concept of performing different types of multiple task and process over a certain period of time by executing simultaneously.

Operating system basically allow various task to run simultaneously by the user. In an operating system, each task consume storage system and all the other resources.

Multitasking function facilitate memory isolation in the processor and also supported different levels of security system in the operating system. For example, "a programmer working on any program in a system and as well as listening the music then, it perform multiple task at the same time".

7 0
2 years ago
Which network type uses a coaxial cable to receive its signal?.
olchik [2.2K]

Answer:

fiber optic

Explanation:

thanks youuuui

6 0
2 years ago
When a customer makes a request or complaint, the goal of customer service is to
Brrunno [24]

Solution:

When a customer makes a request or complaint, the goal of customer service is to show the customer how to remain calm and courteous.

Because the work of the costumer care is  to serve as customers' first point of contact for complaints, questions, requests, feedback, or any other needs; these professionals are essentially charged with managing relationships between clients and the company.

Thus the required answer is D

7 0
2 years ago
Write a pseudocode method swap(aList, i, j) that interchanges the items currently in positions i and j of a list. Define the met
serious [3.7K]

Answer:

Explanation:

The following pseudocode for this method using operations of the ADT list would be the following

swap(aList, indexI, indexJ) {

    initialize temp_variable = Retrieve(indexI, aList)

    Insert(Retrieve(indexJ, aList), indexI, aList)

    Insert(Retrieve(indexI, aList), temp_variable, aList)

}

This code basically saves the aList index of i , into a temporary Variable. Then it sets the aList index of i to the value of the element in index of j. Then it does the same for the index of j with the tem_variable. If we assume that the indexes of i and j exist, then it can crash our entire program if those indexes are missing from the list when we try to access them.

6 0
3 years ago
Other questions:
  • Suppose the program counter (pc) is set to 0x2000 0000. is it possible to use the jump (j) mips assembly instruction to set the
    15·1 answer
  • There are about what licensed drivers here in Florida
    7·1 answer
  • Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra" and "Zoe") and ages respect
    8·1 answer
  • Which of these are examples of a Single Sign-On (SSO) service?
    5·1 answer
  • What is an examlple of cyberbullying
    5·1 answer
  • What did basic elements of music look like in the Twentieth Century period?
    6·1 answer
  • What is internal storage device
    14·1 answer
  • ¿Que es la energía? (una sola respuesta es la correcta)
    11·1 answer
  • which of the following is the most appropriate way to write css style for the font family property in html
    8·1 answer
  • Help me with thissssss
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!