Question

(Sorry for this really stupid question, I just started learning C++ yesterday at school.) How do you run a C++ program? (We only learned how to write one yesterday)
Last edited on
Compile it with a C++ compiler into an executable, then you run it like any other application.
Well, you need a compiler, such as Visual C++ Express or the Bloodshed Group (both free).

For VC++:
You need to open a 'new project' then insert all of your source code into there. After that, you need to go to build -> build project and the .exe should appear. It's somewhere in My docs/Vis C++/projects/<project name>/

For Bloodshed:
I don't use it, so someone else will have to help you here.
it's not working..... the cmd just pops up and then close down.... this is what I treied to test, what's wrong with it?

// hello.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
// TEST

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello!";
return 0;
}
add system("PAUSE") right before your return statement. That'll stop the console from closing down immediately upon completion of main().
Topic archived. No new replies allowed.