|
|
Re: Debugger freezes upon program asking for user input. [message #635949 is a reply to message #635775] |
Thu, 28 October 2010 16:50 |
Greg Akers Messages: 6 Registered: October 2010 |
Junior Member |
|
|
GDB Version= 6.8-2
OS=Xp and 7(tried on both machines, same error).
I guess the most basic example i can give is: (This program works if I run it, but if I debug, when it gets to the 4th line, it will freeze and never ask me for my input. If I just set values myself to one,two,three and nix the cin line, then it will debug all the way through.
#include <iostream>
using namespace std;
int main() {
// inputs the numbers
cout << "Enter three numbers: ";
int one, two, three;
cin >> one >> two >> three;
int tmp;
// orders one and two
if (one > two) {
tmp = one;
one = two;
two = tmp;
}
// orders two and three
if (two > three) {
tmp = two;
two = three;
three = tmp;
}
// orders one and two
if (one > two) {
tmp = one;
one = two;
two = tmp;
}
// outputs the sorted numbers
cout << "The sorted numbers are: ";
cout << one << " " << two << " " << three << endl;
}
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04828 seconds