I had written a C++ program on Xcode. the program compiled and ran just fine. No problems whatsoever.
For some reason, I had to re-install MasOSSierra. I made a backup of all my data, after which I did a clean-wipe and re-installed MacOSSierra.
Naturally, I re-installed XCode. My current version of Xcode is Version 8.3 (8E162).
Now when I run the old program, it won't run. The build succeeds with no error, but there is no display output.
This is the old program. It has a header file.
// **************************************************************
#include <iostream>
#include "PersonalExpenses.h"
bool addmore() {
std::string yn;
std::cout << "Would you like to add a name to the register or quit(Press 0 to exit or 1 to continue)?";
std::getline(std::cin, yn);
return yn != "0";
}
int main(int argc, const char * argv[]) {
std::vector<PersonalExpenses> ledger;
while (addmore()) {
PersonalExpenses udone;
std::cin >> udone;
ledger.push_back(udone);
}
for (const auto &item : ledger) {
std::cout << "\n";
std::cout << item << "\n";
}
}
// **************************************************************
After I run this program, I was expecting to see the following display in the output,
"Would you like to add a name ....."
But I get nothing.
So I modified the above program to something simple,
// **************************************************************
#include <iostream>
int main(int argc, const char * argv[]) {
int a = 10;
std::cout << "The value of 'a' is = " << a ;
}
// **************************************************************
Still no output. But it seems like there is a flicker of an output, before it at all disappears within a fraction of a second. Interestingly, if i change one line to
std::cout << "The value of 'a' is = " << a << "\n" ;
Then the output displays just fine as ,
The value of 'a' is = 10
So what am I missing? Is there any setting that I have to change or is there anthing that I should do to get the old program to work. Thank you.