Its because you have a '\n''\n' left lying on the input stream from a previous call.
cin >>> i; // This reads the number but the '\n' you hit after the number // is still on the input. The easiest way to do interactive user input.
Is is to make sure each line is processed independently (as the user will hit enter after each prompt).
As
As a result always read a line. Then processes, then process the line (until you get familiar with the streams).
std::string line; std::getline(std::cin, line); std::stringstream linestream(line); // Now processes linestream. std::string garbage; lienstream >> i >> garbage; // You may want to check for garbage after the number. if (!garbage.empty()) { std::cout << "Error\n"; }