Simple program where I have to output the lowercase of an uppercase letter and vice versa. Can anyone tell me what to exactly put in the while statement so that the loop will run? That is where the problem seems to be coming from.
#include <iostream>
#include <conio.h>
#include <ctype.h>
usingnamespace std;
char l;
int main()
{
cout << "Enter a lowercase or uppercase letter: " << endl;
cin >> l;
do
{
if (isalpha(l))
{
if (isupper(l))
{
l = tolower(l);
}
else
{
l = toupper(l);
}
}
}
while (isalpha(l)); // Observe you had firstly the while
//positioned in the closing brace of if(isalpha).
// Second you were sending in a already declared
// varible with another declaration.
_getch(); // getch() is also depreciated use _getch()
return 0;
}