Jumping into C++ problems
Hi,, I am trying to solve the problem "Write a menu program that lets the user select from a list of options, and if the input is not oneof the options, reprint the list" using function calls. This is my code
Code:
#include <iostream>
#include <string>
using namespace std;
string choices()
{
return "what do u want?? tea or coffee\n press 1 for tea and 2 for cofee";
}
int main()
{
choices();
string input;
cin>>input;
while(true)
{
if (input=="1"||input=="2")
{ cout<<"please wait";
break;
}
else
{
cout<<"wrong options insert again";
choices();
cin>>input;
}
}
}
problem is,though it compiles fine, the function "choices" never give the cout, no matter how many times I call it.