I wrote a simple program to print out Testscore in Visual Studio .Net 2003
and got the following messages when trying to run it.

'TestScore.exe': Loaded 'D:\Documents and Settings\pooleb\My Documents\Visual Studio Projects\TestScore\Debug\TestScore.exe', Symbols loaded.
'TestScore.exe': Loaded 'D:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'TestScore.exe': Loaded 'D:\WINDOWS\system32\kernel32.dll', No symbols loaded.
The program '[3920] TestScore.exe: Native' has exited with code 0 (0x0).

This is the program:

#include <iostream>
using namespace std;
int main(void)
    short testScore;
        testScore = 3;
        cout << "Your test score is " << testScore << "\n";
        return 0;

It is from an example in C++ Demystified by Jeff Kent.

Am I doing something wrong?

Thanks, BandM

Edited 3 Years Ago by happygeek: fixed formatting

If you want to see the result, you could do the following :


#include <stdlib.h>

before the first line of your program



before the end of your main() function.

include the header file --> #include <stdlib.h>

then add this --> system("pause");
before the return 0;

*It causes the program to stop until it detects any keypress...

Yes, but as prog-bman said, (all my apologies :o ), this is not very smart, as using system("something") calls the external program something.exe.

using getchar(); is in fact much more portable between different systems

Is this something to do with studio .Net? because in VS 6.0 it doesn't do this.

Thanx All!

Your suggestions worked :p

I do want to know why, when I cut and paste one of the Cplusplus snippets
here and paste it into my editor and try to build it I get an error.
I am just starting out so, please be patient.

Thanx, BandM

This article has been dead for over six months. Start a new discussion instead.