杭州国际海运代理:关于C语言的问题~~高手进~~~

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 11:50:27
我是 刚开始学C语言的菜鸟~~~我想问个问题~~~

我照着书上的一个列题 抄写了一变这个程序

mian()
{
printf("hello,world\n");
}

结果运行应该显示 hello,world 的哈

为什么我 用Microsoft Visual C++ 6.0 写的和书上的一模一样 最后运行的时候 老是提示我有一个地方错误 我不知道为什么 我对照了好几变 没有发现写错的地方啊~~~希望高手帮我解答下~~~ 最好可以加下我的QQ 以后 一定还有问题 请教哈

附 (这个就是那个错误说明但是我看不懂咧~迷糊!·)d:\program files\microsoft visual studio\myprojects\hello\hello.cpp(3) : error C2065: 'printf' : undeclared identifier
d:\program files\microsoft visual studio\myprojects\hello\hello.cpp(4) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.

头文件都没有写
#include<stdio.h>
main (){
printf("hello,world\n");
}
应该行

mian() ?????? main()
{
printf("hello,world\n");
}

你的main()方法声明的时候有错
没有返回类型
应该写成void main()//void返回类型为空
{
//方法体
}
QQ:49887134

前面加上:#include<stdio.h>

VC里
cout<<"hello,world\n";

还有
void main()

把文件名保存为.c格式,编译器毛病就会少一点了。main不是mian,记得要#include