Some things which are not clear in your code:
Do you expect to break the while loop using your input? In that case, you should use while (toupper(alphabet) != 'E')
#include <iostream>
usingnamespace std;
int main()
{
char alphabet = 'D';
int count;
char sentinel = 'X';
while (toupper(sentinel) != 'E')
{
cout << "Please enter an alphabet: ";
cin >> alphabet;
switch (alphabet)
{
case'T' : count = 3;
break;
case'S' : count = 6;
break;
case'N': count = 9;
break;
default: count = 12;
}
for (int i = 0; i < count; i++) // outer loop
{
cout << alphabet ;
}
}
}//main
Why do you need the inner loop
Also make instructions more clear...
Why do you have alphabet initialized at the beginning??
What does sentinal do? Why not just have
While(1)
Sentinel is never used besides that