I recently started retraining C ++ from the time I was in high school in my free time (using C ++ Primer, 5th Ed.). When I went through the basic exercises, I noticed that the following program would not execute correctly in Xcode, but would execute correctly on Ideone: http://ideone.com/6BEqPN
#include <iostream>
int main() {
int currVal = 0, val = 0;
if (std::cin >> currVal) {
int cnt = 1;
while (std::cin >> val) {
if (val == currVal)
++cnt;
else {
std::cout << currVal << " occurs " << cnt << " times." << std::endl;
currVal = val;
cnt = 1;
}
}
std::cout << currVal << " occurs " << cnt << " times." << std::endl;
}
return 0;
}
In Xcode, the program does not end. It stops at the last execution of the body of the while loop. In the debug console, I see that there is a SIGSTOP signal.
Screenshot
This is my first time using Xcode for any IDE. I suspect this could be due to my build settings? I configured it for GNU ++ 11 and used libstdc ++.
, Ideone, Xcode. , , IDE , Xcode ++ 11. !