A little Guidance

I'm trying to learn c++ on my own so im kind of basic in my knowledge. i'm using windows 2012 express. i wrote this code and when i tried to compile it i got a C2598:linkage specification must be at global scope error i have tried looking around for the cause but i cant really figure it out. any help would be appreciated.

int main()
{
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

vector<string> list;
vector<string>::iterator listIT;
char end;
int Numbered;
int pointBlank;
string gameName;
cout<< "welcome to the list program. please feel free to list all favorite games."<< endl;
cout<< "if you would like to add a game please type A/nif you would like to delete something from the list please type D/nif you would like to see the current list that you have please type L/nif you would like to end the program type E"<< endl;

do{
char choice;
cout << "what would you like to do? ";
cin >> choice;

choice = toupper(choice);

if(choice == 'A')
{
cout << "please type the name of the game that you would like to add:/n";
cin >> gameName;

list.push_back(gameName);
++pointBlank;

}

else if(choice == 'D')
{
cout << "please select the lisitng by number that you want to get rid of: ";
cin >> Numbered;

list.pop_back(list.begin() + (Numbered - 1));
--pointBlank;
}

else if(choice == 'L')
{
listIT = list.begin();
for(, listIT != list.end(), listIT++)
{
cout << pointBlank,". ", *listIT) << endl;
}
}

else
{
cout << "sorry you have entered n invalid entry please try again." << endl;
}


}while(choice != 'L');
}
Pull the preprocessor #includes out of the main function.

//preprocessor includes

then

//main function


for(, listIT != list.end(), listIT++)

for syntax - use semicolons, not commas between arguments


Edit:

pop_back for vector doesn't take an argument
http://www.cplusplus.com/reference/vector/vector/pop_back/

double check this line - it's not clear what you want to do with the middle part between the <<
cout << pointBlank,". ", *listIT) << endl;


If you edit your post, highlight the code, then click the <> button in the format palette at the right of the post, the code will format better for the forum and show line numbers.
Last edited on
thanks alot, that cleared theproblem right up.
Topic archived. No new replies allowed.