View Single Post
Old Dec 7th, 2004, 5:38 PM   #1
mason
Newbie
 
Join Date: Dec 2004
Posts: 6
Rep Power: 0 mason is on a distinguished road
Send a message via AIM to mason
so here is the source im doing as a weeekly assignment for my class(extra credit) and i gave it a shot and i couldnt seem a way to do it. here is my shot at it could u plz tell me errors and maybe a way to fix it

//Mason Dructor

#include <string>
#include <iostream>
#include <vector>
#include <cctype>
using namespace std;

int main()
{

cout<<"\t\t\tGame Storage Pro\n\n";
cout<<"Welcome, what would you like to do?";
string input;
vector<string> library;
vector<string> gamename;
while(input != "quit")//main program loop
{
cout<<"\n\nIf you want to add a game to the list just type in 'add'.\n";
cout<<"To see your library type in 'library'.\n";
cout<<"To remove a game type in 'remove'.\n";
cout<<"To quit type in 'quit'\n";
cin>> input;
input = toupper(input);
cout<<"You chosed to "<<input.c_str<<".";

vector<string>::const_iterator iter;

if(input == "LIBRARY")
{
for(iter = library.begin(); iter != library.end(); ++iter)
cout << endl << endl << *iter << endl << endl;
}
string add;
if(input == "ADD")
{
cout<<"\n\nType the name of the game you would like to\n";
cout<<"your library.\n";
cin>>gamename;
gamename = toupper(gamename);
library.insert(library.begin(), gamename);
cout<<"You successfully added "<<gamename<<" to your library!\n\n";
}

if(input == "REMOVE")
{
cout<<"\n\nType the name of the game you want to remove.\n";
cin>>gamename;
gamename = toupper(gamename);
gamename.clear();
cout<<"\nYou successfully removed "<<gamename<<" from the library.";
}


return 0;
}
the assignment was to make a program that you can store game names, and view them and to remove them using vectors and iterators and such. like a stock program or sumthing
mason is offline   Reply With Quote