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

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

add

#include <stdlib.h>

before the first line of your program

add

system("pause");

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.

I think VS 6.0 automatically places a pause after your program has executed.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.