What errors are there?

What am I doing wrong, I keep getting 3 errors?

[code]
#include <iostream>
using namespace std;

int main() {

int choice; // to hold an integer representing the user's choice

cout << "------- Menu -------\n"
<< " 1: Charles Dickens\n"
<< " 2: Dr. Seuss\n"
<< " 3: Albert Einstein\n"
<< " 4: Anna of Arendell\n"
<< "--------------------\n"
<< "\n";
cout << "Enter the number of the person to display a quote from"
<< " (1, 2, 3, or 4): ";
cin >> choice;

cout << "\n";

cout << "-----------------------------------------"
<< "--------------------------------------\n";

if (choice == 1) {
cout << "It was the best of times,\n"
<< "it was the worst of times,\n"
<< "it was the age of wisdom,\n"
<< "it was the age of foolishness,\n"
<< "it was the epoch of belief,\n"
<< "it was the epoch of incredulity,\n"
<< "...\n"
<< " -- Charles Dickens, \"A Tale of Two Cities\"\n";
}
else if (choice == 2) {
cout << "You have brains in your head.\n"
<< "You have feet in your shoes.\n"
<< "You can steer yourself in any direction you choose.\n"
<< "You're on your own, and you know what you know.\n"
<< "And you are the guy who'll decide where to go.\n"
<< " -- Dr. Seuss, \"Oh, the Places You'll Go!\"\n";
}
else if (choice == 3) {
cout << "A person who never made a mistake never tried anything new.\n"
<< " -- Albert Einstein\n";
}
else if (choice == 4) {
cout << "Do you wanna build a ☃ ?\n"
<< " -- Anna of Arendell, \"Frozen\"\n";
}
else {
cout << "That is not a valid option!\n";
}

cout << "-----------------------------------------"
<< "--------------------------------------\n"
<< "\n";

return 0; // success
}
[code]
Last edited on
Look at the line just before "Charles Dickens"
I'm getting two errors, its saying

Error 1 error C2146: syntax error : missing ';' before identifier 'cin' c:\users\cpsc\documents\visual studio 2013\projects\project1\project1\source2.cpp 21

Error 2 error C2143: syntax error : missing ';' before '<<' c:\users\cpsc\documents\visual studio 2013\projects\project1\project1\source2.cpp 32
Last edited on
Something wrong with your IDE settings, code is working fine: http://ideone.com/fWAtum
Last edited on
Topic archived. No new replies allowed.