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
Explain the difference between "sleep mode" and "shutdown "
kari74 [83]

Answer:

When you shut down your electronic, all your open programs close and the electronic shuts down your operating system. An electronic that's shut down uses almost no power. In sleep mode, the electronic enters a low-power state. The electronics state is kept in memory.

5 0
2 years ago
If several programs or apps are running simultaneously, your computer or device might use up its
kirill [66]

Answer: I am pretty sure it's RAM

Explanation:

I'm not 100% positive bc I haven't gotten my scores back yet but I think that's it.

7 0
3 years ago
A _____________ is a piece of information sent to a function.<br> The answer is parameter :)
Firdavs [7]
The answer is argument.
3 0
3 years ago
chapter tests and exams are password protected and must be taken in the lab with a universal kiosk browser
Nesterboy [21]

Yes, when a universal kiosk browser (chrome books) being used in the lab during test and exams is protected by avoiding the students to check the answers in the online.

Explanation:

Universal kiosk browser is helpful to display the content on the web on Chrome books. Chrome books are being safe to make student assessment processes. With the help of this, accessing websites to find the answer to the questions in the assessment process by the student is being avoided.

4 0
2 years ago
How would you identify communication equipment?
eimsori [14]

Answer

Explanation:

There should be more context to this question but I would say there is a variety of things that could be seen as communication equipment, such as email, telephone, voice message, through mail.

6 0
2 years ago
Other questions:
  • What shortcut bring up the print page
    8·2 answers
  • Which is the default scripting language in most browsers? A. ASP B. JavaScript C. PHP D. XML
    12·1 answer
  • the equation t= 0.25d^1/2 can be used to find the number of seconds, t, that it takes an object to fall a distance of d feet how
    8·1 answer
  • The Mishiba Huya LED bulbs enable consumers to control lighting in their homes using a smartphone or tablet. When connected to a
    11·1 answer
  • Within the sites that support disaster recovery, __________ is a separate facility that does not have any computer equipment but
    7·1 answer
  • A strategic information system can be any kind of information system that uses information technology to help an organization __
    11·1 answer
  • Calculate the ERA
    6·1 answer
  • What is the full path and filename for the file on a Debian Linux distribution that displays the time zone settings?
    13·1 answer
  • Need help on Assignment 4: Evens and Odds
    5·1 answer
  • Briefly describe the traditional definition of the digital divide. What is it and who is affected, positively and adversely? How
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!