I have a regular console registration form:

void register_1() { string login, parol; cout << "Введите логин:" << endl; cin >> login; cout << "Введите пароль:" << endl; cin >> parol; ofstream fout("users.txt", ios::app); fout << login << " " << parol << endl; cout << "Регистрация прошла успешно!" << endl; main(); } 

Before writing to the file, I need to check the correctness of the input so that there are such parameters: Russian capital letters and small letters from A to Z and special characters:. , *% I thought to create an array of such characters and run it through for () if (), but this is a bad idea (help please!

  • For good you need to use third-party libraries to work with Unicode. For bad you can std::regex_match for std::wregex form [а-яА-Я\.,\*%] - cpp questions
  • @cppquestions I’m a ram in this case, only recently the course on the fundamentals of OOP in C ++ was completed at the university, so if possible, please explain the methods you wrote - Norfo4ik
  • std::regex_match checks with the help of the regular expression [а-яА-Я\.,\*%] , represented by the class std::wregex , whether a certain string corresponds to this regular expression. All of this for C ++ is described here - cpp questions
  • one
    @cppquestions Thank you, figured out) - Norfo4ik
  • @cppquestions Still a question) It in no way wants to work with Cyrillic. How to fix it? - Norfo4ik

0