Ok so the task is to ask the user for a letter and then display weather that letter is a vowel or consonant then ask the user if they would like to continue (y/n) this is what i have and i need some help ALL OF THIS HAS TO BE DONE USING EITHER DO WHILE LOOPS OR FOR.
(I'm using a mac, so this is all done through Xcode)
I would really like to know if there is a way for input validation on entering a letter like i put below so when they enter a letter it has to be between 'A' and 'Z' or it asks them to enter a capital letter again
#include <iostream>
using namespace std;
int main()
{
char ans;
char let;
do {
cout<< "Please enter a Captial Letter"<< endl;
cin>> let;
} while (let>'A'||let<'Z');
do{
if(let=='A' || let=='a'){
cout<<"Vowel"<< endl;
}else if (let=='E' || let=='e'){
cout<<"Vowel"<< endl;
}else if (let=='I' || let=='i'){
cout<<"Vowel"<< endl;
}else if (let=='O' || let=='o'){
cout<<"Vowel"<< endl;
}else if (let=='U' || let=='u'){
cout<<"Vowel"<< endl;
}else{
cout<< "Consonant"<< endl;
}
cout<< "Would you like to continue? (Y/N)"<< endl;
cin>> ans;
} while (ans=='Y' || ans=='y');
Not really i know the ACSll code so i changed it to let <65 || let >90 so it now gives me the input validation I'm looking for but I'm still fuzzy on how its should be actually coded i think I'm screwing up placement of my do whiles