so basically when an input is entered it has to be against two conditions. if its exit terminate the while loop immediately and if the a copy of the input exists in the input1(which is a map) only then save it in the finallist(map). if such input is entered which doesnt exists in input1. the user should be asked again to enter something else. this what i have so far. for exit and for other inputs its working fine. when i enter a valid input it still says "this item is not in the section..." can someone please help. what conditionw should i put to make this work.
cout << "enter the items you want to buy. press exit to proceed" <> a; int choice;
LOOP: while(select1 != "exit")
{
for(it = input1.begin(); it != input1.end(); ++it)
{
if(it -> first != a) continue;
{
choice= input1[select1];
finallist[a] = choice;
cout << "you bought " << a << " for price "<< finallist[a]<<endl;
spentmoney(choice); //calculate prices
cin >> a;
if(select1 == "exit")
{
goto LOOP;
}
choice = input1[a];
finallist[a] = choice;
cout << "you bought "<<a <<" for price<< finallist[a}<<endl;
spentmoney(choice);
}
}
cout<< "This Item is not available in the section you are in" << endl;
cout << "Buy something else"<< endl;
cin >> a;
if(a == "exit")
{
goto LOOP;
}
}
Aucun commentaire:
Enregistrer un commentaire