为什么加了system("pause");没用

为什么加了system("pause");没用,第1张

如楼上所说你要加上一个头文件 #include<stdlib.h>

stdlib 头文件里包含了C语言的一些函数

该文件包含了的C语言标准库函数的定义

stdlib.h里面定义了五种类型、一些宏和通用工具函数。类型例如size_t、wchar_t、div_t、ldiv_t和lldiv_t;宏例如EXIT_FAILURE、EXIT_SUCCESS、RAND_MAX和MB_CUR_MAX等等;常用的函数如malloc()、calloc()、realloc()、free()()、system()、atoi()、atol()、rand()()、 srand()()、exit()等等。 具体的内容你自己可以打开编译器的include目录里面的stdlib.h头文件看看。

conio.h

conio.h不是C标准库中的头文件。

conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应 *** 作,比如getch()()函数等等。

包含的函数

cgets(char *)

cprintf(const char *, ...)

cputs(const char *)

cscanf(const char *, ...)

inp(unsigned short)

inpw(unsigned short)

getch()(void)

getch()e(void)

kbhit(void)

outp(unsigned short, int)

outpw(unsigned short, unsigned short)

putch(int)

ungetch(int)

void _Cdecl clreol (void)

void _Cdecl clrscr (void)

void _Cdecl delline (void)

int _Cdecl gettext (int left, int top, int right, int bottom,

void *destin)

void _Cdecl gettextinfo (struct text_info *r)

void _Cdecl gotoxy (int x, int y)

void _Cdecl highvideo (void)

void _Cdecl insline (void)

void _Cdecl lowvideo (void)

int _Cdecl movetext (int left, int top, int right, int bottom,

int destleft, int desttop)

void _Cdecl normvideo (void)

int _Cdecl puttext (int left, int top, int right, int bottom,

void *source)

void _Cdecl textattr (int newattr)

void _Cdecl textbackground (int newcolor)

void _Cdecl textcolor (int newcolor)

void _Cdecl textmode (int newmode)

int _Cdecl wherex (void)

int _Cdecl wherey (void)

void _Cdecl window (int left, int top, int right, int bottom)

har *_Cdecl cgets (char *str)

int _Cdecl cprintf (const char *format, ...)

int _Cdecl cputs (const char *str)

int _Cdecl cscanf (const char *format, ...)

int _Cdecl getch (void)

int _Cdecl getche (void)

char *_Cdecl getpass (const char *prompt)

int _Cdecl kbhit (void)

int _Cdecl putch (int c)

int _Cdecl ungetch (int ch)

加上头文件#include<cstdlib>using namespace std

或者#include<windows.h>using namespace std

首先,建议使用Visual Studio 2008.NET, VC++ 6.0 还是98年的版本了。

在C++下使用 system() 函数只需要包含 iosream 头文件就可以了

在C中需要包含 stdlib.h 或者 dos.h 头文件

应该不会出现停不下的情况的,建议监察一下前面的字符串输入部分是否有问题.或者把你的程序贴出来看看.


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/7881527.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-11
下一篇2023-04-11

发表评论

登录后才能评论

评论列表(0条)

    保存