Yo just remembered this topic and threw this together hopefully its what you were looking for. it just compares each character to see if its a space or letter(upper and lowercase);
Code:
#include <iostream>
#include <string>
using namespace std;
bool ifValidName(string s)
{
for(i=0;i<s.size();i++)
{
int asciicode =s[i];// convert char to ascii int value
if(asciicode == 32 || (asciicode >=65 && asciicode<=90) || (asciicode >=97 && asciicode<=122));
else return false;// if its not a space or letter return false
}
return true;
}
void main()
{
string name;
cout << "Enter your Full Name: " << endl;
getline(cin, name);
if(ifValidName(name)) cout << "real name" <<endl;
else cout << "enter a valid input you noob" << endl;
cout << endl;
system("Pause");
}
If you want it to keep asking for the name until you get a valid one you can use goto statements(although some instructors dislike them) or a while loop. Idk if you've gone over functions yet. If not, I could modify the code to handle all of it in the main function.