I wrote some very simple code since I’m just starting C++ and I want to get warmed up with the syntax and compiler before our binary tree assignment.
#include <iostream>
using namespace std;
int main(){
cout << "Hello";
return 0;
}
The only output I’m receiving is:
1> Build started: Project: First-BinaryTree, Configuration: Debug Win32 ------
1>Compiling...
1>First-BinaryTree.cpp
1>Build log was saved at "file://c:\Users\Administrator\Documents\Visual Studio 2008\Projects\First-BinaryTree\First-BinaryTree\Debug\BuildLog.htm"
1>First-BinaryTree - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
It appears to have run correctly, but I don’t see Hello in the output anywhere.
It seems that you have just built the project, without starting it. If you want to start it, you have to go to Debug->Run. However, keep in mind that in that way the executable will be started, it’ll run and its window will disappear in some fraction of second, since it does almost nothing. If you want to be able to see the output, you may:
For the flushing thing that someone mentioned, I’m not sure if it’s needed: at the end of the program the cout object is destroyed, so it should flush itself automatically (correct me if I am wrong).