#include<iostream>
using namespace std;
void main()
{
char fname[11];
int x = 0;
cout << "Please enter the name: ";
cin >> fname;
while (fname[x] != '\0')
{
int i=int(fname[x]);
if (i>=97)
cout << fname[x];
x++;
}
else
cout << "Invalid characters";
system("pause");
}
I tried to validate char input by using above codes. But couldn't do it.
What is wrong with these codes?