Question

C++ What is printed to the console? map<string, string> firstLast; firstLast["Adjunct"] = "Lorn"; firstLast["Onos"] = "T'oolan";...

C++

What is printed to the console?

map<string, string> firstLast;

firstLast["Adjunct"] = "Lorn";
firstLast["Onos"] = "T'oolan";
firstLast["Crokus"] = "Younghand";
firstLast["Toc"] = "The Elder";
firstLast["Karsa"] = "Orlong";
firstLast["Anomander"] = "Rake";
firstLast["Toc"] = "The Younger";
firstLast["Adjunct"] = "Paran";

for (map<string, string>::iterator it = firstLast.begin();
it != firstLast.end();
it++)
cout << (*it).first << " " << (*it).second << endl;

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Adjunct Paran
Anomander Rake
Crokus Younghand
Karsa Orlong
Onos T'oolan
Toc The Younger


Add a comment
Know the answer?
Add Answer to:
C++ What is printed to the console? map<string, string> firstLast; firstLast["Adjunct"] = "Lorn"; firstLast["Onos"] = "T'oolan";...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Tying to list all the courses the teacher teaches in c++ map but only the first...

    Tying to list all the courses the teacher teaches in c++ map but only the first one is being shown, not the rest of them. please help. ------------------------------------------------------------------------------------------------------------------------------ #include<iostream> #include<map> using namespace std; int main(){                 map <string,string> instructors;                 //mapping course numbers and instructor names                 instructors.insert(pair<string,string>("Haynes","CS101"));                                instructors.insert(pair<string,string>("Haynes","CS102"));                                instructors.insert(pair<string,string>("Haynes","CS103"));                 instructors.insert(pair<string,string>("Alvarado","CS201"));                                instructors.insert(pair<string,string>("Alvarado","CS202"));                                instructors.insert(pair<string,string>("Alvarado","CS203"));                                char choice='y';                 //looping until user wishes to quit                 while(choice=='y' || choice=='Y'){                                 cout<<"Enter a...

  • I need to make a few changes to this C++ program,first of all it should read...

    I need to make a few changes to this C++ program,first of all it should read the file from the computer without asking the user for the name of it.The name of the file is MichaelJordan.dat, second of all it should print ,3 highest frequencies are: 3 words that occure the most.everything else is good. #include <iostream> #include <map> #include <string> #include <cctype> #include <fstream> #include <iomanip> using namespace std; void addWord(map<std::string,int> &words,string s); void readFile(string infile,map<std::string,int> &words); void display(map<std::string,int>...

  • I need to add something to this C++ program.Additionally I want it to remove 10 words...

    I need to add something to this C++ program.Additionally I want it to remove 10 words from the printing list (Ancient,Europe,Asia,America,North,South,West ,East,Arctica,Greenland) #include <iostream> #include <map> #include <string> #include <cctype> #include <fstream> #include <iomanip> using namespace std; void addWord(map<std::string,int> &words,string s); void readFile(string infile,map<std::string,int> &words); void display(map<std::string,int> words);    int main() { // Declaring variables std::map<std::string,int> words;       //defines an input stream for the data file ifstream dataIn;    string infile; cout<<"Please enter a File Name :"; cin>>infile; readFile(infile,words);...

  • Id: 40100885 in c++ output text please thanks! what is the output values printed by the...

    Id: 40100885 in c++ output text please thanks! what is the output values printed by the following code? You need to explain step by step how each printed value is calculated. #include <iostream> using namespace std; int m = 0; void SampleMethod (int); int SampleMethod(); void increase(); int main() { int j = 9; SampleMethod(j); cout << j<<endl; return 0; w Y == void SampleMethod(int i) { if (j%2 1) cout << SampleMethod() <<endl; else cout << j << "...

  • Java Method Resolution : Consider the following example: What is printed on the console if Main...

    Java Method Resolution : Consider the following example: What is printed on the console if Main is executed, and why? How the codes could be improved? public class Main {     public static void main(String[] args) throws Exception {         A obj = null;         obj.foo();     } } public class A {     public void foo() {         System.out.println(“foo in A”);     } }

  • Can sombody tell me what wrong for this code to work?? It is c++ btw. thanks!...

    Can sombody tell me what wrong for this code to work?? It is c++ btw. thanks! #include <iostream> #include <string> using namespace std; double op1; double op2; string ADD; string SUBTRACT; string MULTIPLY; string DIVIDE; string selection; string multiply; string divide; string add; string subtract; string "*"; string "+"; string "-"; string "/"; int main() { do { cout << "--------WELCOME TO THE CALCULATOR----------" << endl; cout << "Enter your first operand: "; cin >> op1; cout << "Enter your...

  • Iteration statements. Consider the following for statement in C++. What is printed at each execution of...

    Iteration statements. Consider the following for statement in C++. What is printed at each execution of the loop? int sum1 = 0, total = 0; double sum2 = 0; for (sum1 = 0, sum 2 = 1.0;    sum1 < 5 && sum 2 <= 25.0;    sum2 /= 5)    total = ++sum1 + sum2;    cout << “ total is “ << total << endl;

  • ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" :...

    ,,1. Which of the following statments are valid C++ statements? A) cout << "Hello World" : B) cout << Hello World; C) cout << "Hello " << "World" ; D) cout << "Hello" << "World" ; 2. What is the difference between the literals 'A' and "A"? ,3. Read the input from user; Check for valid entries If input is invalid: print an error message; else: calculate the result and print to the console; exit; The code snippet above may...

  • c++ Consider the following statement string str "Now is the time for the party!" What is...

    c++ Consider the following statement string str "Now is the time for the party!" What is the output of the following statements? (Assume that all parts are independent of each other.) a. cout <str·size ( ) end 1 ; b. Cout << str. substr (7, 8) <<endl: c. string: :size type indstr.find'£') string s str. substr (ind 4, 9); d. cout << str insert (11,"best " <<endl e. str.erase (16, 14) str.insert (16, "to study for the exam? ") cout...

  • MICROSOFT VISUAL STUDIO C++: 13. What will be printed when the following statements are executed? int...

    MICROSOFT VISUAL STUDIO C++: 13. What will be printed when the following statements are executed? int x = 0, y = 0; do { if(x == y) x= x + 1; else y=y — 1; } while (x<y + 4); cout << “y=“ <<y <<“ X=" << x << endl;

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT