I have to make this program: I have to enter x number of letters in the same line and the program has to count vowels and consonants. So I've made a program that does all that except I don't know how to enter the letters in the same line.
P.S. I know this is a basic c++ but couldn't find a better place to post this.
Code:#include <iostream> using namespace std; int main() { char letter; int vow = 0; int con = 0; cout << "Enter the letters. To end the input insert a: " << endl; do { cin >> letter; if (letter=='a'||letter=='e'||letter=='i'||letter=='o'||letter=='u'||letter=='A'||letter=='E'||letter=='I'||letter=='O'||letter=='U') { vow++; }else { con++; } }while(letter!='a'); cout << "Number of vowels is: " << vow << endl; cout << "Number of consonants is: " << con << endl; return 0; }



LinkBack URL
About LinkBacks



