cursor limit in c++

Hi can I ask for your help. Basically I want a program that accepts a student number, a cellphone number and a birthday. So the student number has 10 digits, I want to make the cursor stop if you entered 10 digits, I just dont know how to do that. Can somebody help me? Thanks in advance :)
AFAIK, you'll need to use some sort of library like Ncurses to do this.

But really, it would be easier to just check the length after they've entered and make sure it's no more than 10.

Oooor, use some sort of GUI library :)
Actually Ive tried using char but it wont do any good. Im a beginner in C++ so i dont know what to do :)
Char is a datatype, Ncurses a whole library meant for building fancy UIs within a terminal.

Here's a way to just check if the user entered more than 10 characters.

1
2
3
4
5
6
7
std::string input;
std::getline(std::cin, input);
while(input.length() > 10)
{
    std::cout << "Please keep it under 10 characters, mmmkay.\n"
    std::getline(std::cin, input);
}
Topic archived. No new replies allowed.