Category : input

int main () { int cntrl=0; std::locale loc; std::string str="first line n second line n"; for (std::string::size_type i=0; i<str.length(); ++i) { if (std::iscntrl(str[i])) { cntrl++; } } std::cout << cntrl; return 0; } int main () { int cntrl=0; std::locale loc; std::string str; getline(std::cin,str); for (std::string::size_type i=0; i<str.length(); ++i) { if (std::iscntrl(str[i])) { cntrl++; } ..

Read more

I need a way to get user input in c++, something like "Press enter to exit", but cin >> user_input requieres you to enter text (without even reading the spacebars). getch() works but not in linux and <termios> doesn’t work in Windows, any other way to get user input? Source: Windows Que..

Read more