To answer this question:
Read, from the keyboard, one character at a time until the user enters a letter ('A'..'Z' or 'a'..'z').
Example: LETTER ? 4 // invalid character; so, ask for another letter LETTER ? . // repeat ... LETTER ? / // ... LETTER ? # LETTER ? k // finally, the user typed a letter !!!
I wrote the following code:
#include <iostream>
#include <stdio.h>
#include <ctime>
#include <string.h>
#include <cstring>
#include <ctype.h>
using namespace std;
int main(int letter){
cout << "LETTER ? ";
cin >> letter;
if (!isalpha(letter))
{main(letter);}
else
{};
return(0);
};
If it is a number it is working. If it is a symbol or a letter it's saying LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? LETTER ? (...)
Could you please help me?