0

I have visual studio express 2013 for windows desktop installed and wrote first hello world world program. When I compile it it shows no errors. When I hit local windows debugger button the console window flashes with a result for 1/4 second and goes away. What should I do to keep it there so that when I program longer codes I won't have any difficulty.

Thanks.

1
  • Goto Debug Menu->Press StartWithoutDebugging - Done... Apr 13, 2014 at 5:20

2 Answers 2

0

Adding system("pause"); or int x; scanf("%d", &x); at the end of your main() function are popular options.

1
  • 1
    I think there's no cin in C. Apr 13, 2014 at 5:08
0

Use the following template on your programmes, whenever you compile a C programme using Microsoft Visual Studio 2013:

//#define _CRT_SECURE_NO_WARNINGS
// un-comment the line above, if you want to
// be able to use functions like scanf instead
// of their more secure versions like scanf_s
#include <stdio.h>


int main( /* int argc, char ** argv */ ) {


    fflush( stdin );
    getchar( );
    return 0;
}

This is the most simple template you could use for MSVC 2013. Do not use fflush( stdin ); in anywhere else, it has no defined behaviour elsewhere, it is microsoft-specific.

Not the answer you're looking for? Browse other questions tagged or ask your own question.