猿问

C++运行窗口闪退

#include <stdio.h>

  int main()

{

   int year=2015;

   if ((year % 4 == 0 && year % 100) || (year % 400 == 0)) {

printf("%s\n", "今年是闰年");

}

else {

printf("%s\n", "今年是平年");

}

printf("Press any key to continue...\n");

      return 0;

}

生成的时候没问题,调试的时候,窗口一闪就没了

The program '[7312] Project3.exe' has exited with code 0 (0x0).

这是vasual studio2015中的VC++,求大神告知

ZOL慕雪瞳
浏览 4041回答 3
3回答

流浪_老

#include <stdio.h>#include<stdlib.h>  int main(){   int year=2015;   if ((year % 4 == 0 && year % 100) || (year % 400 == 0)) {printf("%s\n", "今年是闰年");}else {printf("%s\n", "今年是平年");}printf("Press any key to continue...\n");system("pause");      return 0;}

深水曲静

#include<stdlib.h>system("pause");return 0;
随时随地看视频慕课网APP
我要回答