Just got back to programming after some intense FFXI. I'm picking up where I left off at and that would be on vectors. I'm making a shop program where you will be able to add items to your inventory and later on sell them, but for now I just want it to display things when you type in some keywords. I'm getting errors for ISO, conflicting, and previous. Not a clue in the world what those last two were. I'm goin to put in a do while in somewhere, but thats for another day.
code:
Code://Item Viewer v1.0 #include<iostream> #include<string> #include<vector> #include "input.h" using namespace std; int main() { //Declaring Stuff string quit, items, shop, key; vector<string> inventory(10, "empty slot"); vector<string> shop; shop.push_back("¤20 Ether"); shop.push_back("¤15 Potion"); shop.push_back("¤10 Antidote"); //Welcome Player cout<<"Welcome to Item Viewer v1.0!"<<endl; cout<<"Keywords: items, shop, and quit"<<endl; cout<<"\nTo see the keywords again, type key"<<endl; //input input(); //code for input header if u need it :) /* int input() { string inpt; cin>>inpt; }*/ //Ahhhh, the if statments if(input() == "key") { cout<<"Keywords: items, shop, and quit"<<endl; system("pause"); } if(input() == "items") { system("cls"); for(int x = 0; x < inventory.size(); x++) { cout<<inventory[x]<<endl; } system("pause"); } if(input() == "shop") { system("cls"); for(int x = 0; x < shop.size(); x++) { cout<<shop[x]<<endl; } } }



LinkBack URL
About LinkBacks



.