What I have to do to get this C++ right? I also did all the letters.
Have the user enter a letter for a minimum of 10 letters, send the letter
as a parameter to a function, and in the function, print out an
animal that begins with that letter. Letters can be entered in upper or
lower case. Keep asking the user to enter a letter until they enter x, then
tell them there is no animal that begins with x, and end the program.
You need to put lines 8-9 in the loop (and use a do-while loop, or asign a dummy value to x):
1 2 3 4 5 6 7 8
char x = 'a'; //you don't need big X in this scope (only in the fun1 function)
while (x!='x' && x!='X')
(
//ask the user for input over and over
cout<<"enter a letter"<<endl;
cin>> x;
fun1(x) //and here you need to pass little x as the argument (not big X)
);
Please let me know if you don't understand something...
Thanx Math.
of course we both had our little errors in our code there. Looks like it should be this instead of what u put in. Works perfectly though, thanx again..
1 2 3 4 5 6 7
char x= 'a';
while (x!='x' && x!='X')
{
cout<<"enter a letter"<<endl;
cin>> x;
fun1(x);
}