c++ - Why does cin cause this program to hang? -
i have posted relevant code below. when compile program, runs , reaches point waits input. type in integer , press enter, code never continues. how go correcting this?
int i; cout << "please input column sort by: "; cin >> i;
well, first of all, posted above won't compile. try instead:
#include <iostream> int main(int argc, char *argv[]) { int i; std::cout << "please input column sort by: "; std::cin >> i; std::cout << "you entered: " << << "\n"; return 0; }
compile g++ -o3 thefile.cpp
, assuming file called "thefile.cpp".
if doesn't work there serious issue going on. if should able diagnose issue further.
Comments
Post a Comment