Mar 19, 2010 at 5:21pm UTC
k i want the functions to go if ans= yes or no but if i type anything it goes to the function.
1 2 3 4 5 6
cout<<"yes or no?" <<"\n" ;
cin>> ans;
if (ans == "yes" or"no" )
{
//functions
}
Last edited on Mar 19, 2010 at 5:25pm UTC
Mar 19, 2010 at 5:37pm UTC
i tried
1 2 3 4 5 6
cout<<"yes or no?" <<"\n" ;
cin>> ans;
if (ans == "yes" ||"no" )
{
//functions
}]
but it still just does the function if i type anything.
Last edited on Mar 19, 2010 at 5:37pm UTC
Mar 19, 2010 at 5:41pm UTC
First off, why are you checking both yes and no and still entering the same function? Also, when you use the Logical Operators it should look like this:
if ( ans == "yes" || ans == "no" )
Mar 19, 2010 at 5:42pm UTC
ahhh k ty.I'm just using yes and no as an example.