vs2013 程序暂停代码
方法一:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #define PRICE 30; /*定义一个符号常量*/ int _tmain(int argc, _TCHAR* argv[]) { int num, total; num = 10; total = num * PRICE; printf("total %d\n",total); fflush(stdin); /*清空输入缓冲区,通常是为了确保不影响后面的数据读取(例如在读完一个字符串后紧接着又要读取一个字符,此时应该先执行fflush(stdin);)。*/ getchar(); //用于暂停程序 return 0; } |
方法二:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" //#include "stdio.h" //#include "math.h" #include "windows.h" #define PRICE 30; /*定义一个符号常量*/ int _tmain(int argc, _TCHAR* argv[]) { int num, total; num = 10; total = num * PRICE; printf("total %d\n",total); system("pause"); //通过system函数调用cmd命令 return 0; } |
二〇一四年九月二十八日 14:31:52
版权声明:
作者:龙魂
链接:https://blog.wlzs.cn/vs2013-%e7%a8%8b%e5%ba%8f%e6%9a%82%e5%81%9c%e4%bb%a3%e7%a0%81/
来源:学海无涯
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
vs2013 程序暂停代码
方法一:
Shell
// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#define PRICE 30;……

共有 0 条评论