Hello everyone, now I’ve dealt with the cctype library in C and came across a toupper function that changes characters from lower case to upper case. Here I wrote a small code (I did not use char, as in the example):
#include <iostream> #include <cctype> using namespace std; int main() { string str1; cout << "Введите Y или N для дальнейшей работы: "; do { str1 = cin.get(); str1 = toupper(str1); } while(str1 != "Y" || str1 != "N") if (str1 == "Y") { cout << "Спасибо, что ввели: " << "str1" << endl; } else {cout << "попробуйте еще раз" << endl;} }
I get a compiler error:
prog.cpp: 12:28: error: no matching function for call to 'toupper (std :: string &)' str1 = toupper (str1);
I can not understand what's the matter - because everything seems to be correctly written in the 12th line. Help me fix it.