Use
cin >> totalquestions;
Check the errors too
if (!(cin >> totalquestions)) { // handle error }
Related Posts:
- How can I convert a std::string to int?
- Easiest way to convert int to string in C++
- c++ parse int from string [duplicate]
- How to convert QString to int?
- Function stoi not declared
- Function stoi not declared
- Why are there two different getline() functions (if indeed there are)?
- I’m getting the error “stoi is not a member of std” in myprogramminglab [duplicate]
- Why the switch statement cannot be applied on strings?
- How to convert string to char array in C++?
- std::string to char*
- How to convert string to char array in C++?
- C++ — expected primary-expression before ‘ ‘
- Using getline() with file input in C++
- C++ string to double conversion
- Conversion from string to char – c++
- What is `CString`?
- How do I include the string header?
- Differences between C++ string == and compare()?
- How do I convert a double into a string in C++?
- Split a string using C++11
- How do I iterate over the words of a string?
- Check if a string contains a string in C++
- std::cin.getline( ) vs. std::cin
- How do I iterate over the words of a string?
- Returning an empty string : efficient way in c++
- Replace part of a string with another string
- C++ string to double conversion
- What is use of c_str function In c++
- How to reverse an std::string? [duplicate]
- When and why do I need to use cin.ignore() in C++?
- C++ Parsing input string to variables
- std::string to char*
- How to convert a std::string to const char* or char*
- How do I tokenize a string in C++?
- Why use string::iterator rather than index?
- Using the fstream getline() function inside a class
- getline() does not work if used after some inputs
- identifier “string” undefined?
- Press Enter to Continue
- Parsing a comma-delimited std::string
- How can I convert const char* to string and then back to char*?
- How to copy a string of std::string type in C++?
- How to return a string from a C++ function?
- What is the difference between isdigit() and isnumber()?
- Convert char* to string C++
- printf with std::string?
- Convert a String In C++ To Upper Case
- Right way to split an std::string into a vector
- Read whole ASCII file into C++ std::string
- Reading getline from cin into a stringstream (C++)
- C++: std does not have member “string”
- Right way to split an std::string into a vector
- string subscript out of range error
- C++ String Variable Declaration
- Returning an empty string : efficient way in c++
- Split a string into an array in C++
- splitting a string into an array in C++ without using vector
- Remove spaces from std::string in C++
- Remove spaces from std::string in C++
- c++ convert string to hex
- How can I iterate through a string and also know the index (current position)?
- C++ strings and pointers
- C++: Using ifstream with getline();
- How to Convert a C++ String to Uppercase
- std::wstring VS std::string
- C++ Simple hangman game
- Remove First and Last Character C++
- C++ Remove punctuation from String
- C++ string to enum
- C++ Convert string (or char*) to wstring (or wchar_t*)
- Integer to hex string in C++
- c++ Read from .csv file
- C++ – Assigning null to a std::string
- How to alphabetically sort strings?
- Reading string by char till end of line C/C++
- How do I check if a C++ std::string starts with a certain string, and convert a substring to an int?
- Reading multiple lines from a file using getline()
- getline: identifier not found
- Dynamically allocated string array, then change it’s value?
- Convert char array to single int?
- https://stackoverflow.com/questions/3865946/error-generic-array-creation
- Fastest way to Convert String to Binary?
- How to print a string in C++
- std::string length() and size() member functions
- Which is faster C++ String length() or size()?
- How do I create a random alpha-numeric string in C++?
- Is string::compare reliable to determine alphabetical order?
- error: switch quantity not an integer
- Reading a string from file c++
- casting int to char using C++ style casting
- Remove last character from C++ string
- c++ sizeof( string )
- How to do std::string indexof in C++ that returns index of matching string?
- variable or field declared void
- C++ compiler error c4430 “c++ doesnt support default int”
- convert string to size_t
- ‘setprecision’ is not a member of ‘std’
- Converting bool to text in C++
- Why does my program give “NULL used in arithmetic”