Some fun errors
Oct 31, 2013 at 9:09pm UTC
I'm writing a program that has various operations preformed on a vector of 16 restaurants. I'm in the process of setting this bad boy up, and suddenly I get some issues.
line 50: expected an identifier for new
line 52: more than one operator ">>" matches these operands
expected a type specifier for ";"
Any help would be much appreciated!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
#include <iostream>
#include <iomanip>
#include <ctime>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
int main()
{
vector<string> restaurant;
restaurant.push_back("Wendy's" );
restaurant.push_back("McDonalds" );
restaurant.push_back("Popeye's" );
restaurant.push_back("Starbucks" );
restaurant.push_back("Tucanos" );
restaurant.push_back("Cafe Rio" );
restaurant.push_back("The Slab" );
restaurant.push_back("Hoagieville" );
restaurant.push_back("Taco John's" );
restaurant.push_back("Olive Garden" );
restaurant.push_back("Lion's Tap" );
restaurant.push_back("The Roasted Pear" );
restaurant.push_back("Panda Express" );
restaurant.push_back("Cinnabon" );
restaurant.push_back("Texas Roadhouse" );
restaurant.push_back("The Alley Connection" );
int bob=0;
while (bob=0)
{
cout<<"Welcome!" <<endl<<"Main Menu:" <<endl;
cout<<"Display all restaurants: Please enter A" <<endl;
cout<<"Add a restaurant: Please enter B" <<endl;
cout<<"Remove a restaurant: Please enter C" <<endl;
cout<<"Shuffle the restarurants: Please enter D" <<endl;
cout<<"Begin the tournament: Please enter E" <<endl;
cout<<"Quit the program:Please enter Q" <<endl;
string selection;
cin >> selection;
if (selection=="A" ||selection=="a" )
{ //run display all restaurants
}
if (selection=="B" ||selection=="b" )
{
string new ;
cout<<"Please enter the restaurant you would like to add" <<endl;
cin >> new ;
}
if (selection=="C" ||selection=="c" )
{ //run remove
}
if (selection=="D" ||selection=="d" )
{//run shuffle
}
if (selection=="E" ||selection=="e" )
{ //run shuffle
}
if (selection=="Q" ||selection=="q" )
{ return 0;
}
}
system ("PAUSE" );
return 0;
}
Oct 31, 2013 at 9:23pm UTC
You can't call a string 'new' because that's a C++ reserved word. Choose another name for your string.
Oct 31, 2013 at 9:40pm UTC
Thank you!
Topic archived. No new replies allowed.