nuttyDeedee

Hi, I want to run the simplest possible C++ program (Hello World) on VS 2005 . When I build it I receive no errors, but I do not see the output on the command line. I tried other short programs and it is still not working. Do you have ideas how to fix this problem thanx


Re: Visual C++ Express 2008 (Pre-release) VS 2005: problems with running C++ programs

ilogpasig

try this:

#include <stdio.h>

void main() {

printf("Hello world\n");

char ch;

scanf("%c",&ch);

}





Re: Visual C++ Express 2008 (Pre-release) VS 2005: problems with running C++ programs

Jonoboy

Can you tell me what you typed and how many times did you tried





Re: Visual C++ Express 2008 (Pre-release) VS 2005: problems with running C++ programs

ilogpasig

Hi,
The purpose of the "scanf" is to stop the program from exiting after it prints "Hello world" because it's waiting an input from the keyboard.

If you run the program from within the IDE and without the "scanf", the program prints "Hello world" then prints, "Press any key to continue..."

But if you run the program by double-clicking the resulting stand-alone ".exe" file (and without opening a DOS console), it runs within a split second then exits. That's why you don't see any output.