c语言格式化输出

来源:百度知道 编辑:UC知道 时间:2024/09/19 16:39:31
main()
{
printf("123");
getch();
}
大家说我哪里错了。。为什么运行不了?

printf 函数不需要头文件的
程序没错
不过你用的是什么开发软件
getch();好像是再wintc的末尾加上起暂停作用的
如果你不是用wintc编写 就不要加getch();这个句子

#include <stdio>

可这样写
#include <stdio.h>

void main()
{
printf("123");

getchar();
}

getch();需要头文件#include <conio.h>

大哥,你连头文件都没打出来,我哪知道你是不是应为这个所以错了,还有就是你想要的应该是getchar()吧,除非那个是你自己编的

getch();
错了,是getchar();
还有少了头文件#include <stdio> ,main前面最好加上void,如果你的版本是turboC2.0就会发生错误。

#include <stdio.h>

int main()
{
printf("123");

getch();

return 0;
}

GCC国际标准写法。。。已验证

getch();//就是不需要重复了,我以前也喜欢用~