如何用c语言写hello world

img


这为啥不能运行,运行错误,试了好多次了,求各位快点回答,谢谢啦!

总结一下:
题主代码中问题:头文件引用拼写错误,是iostream;引用该头文件后,实际是使用了C++的I/O库函数了,代码为c++代码。可以用cout输出,cin输入;
然后主函数第4行多了个逗号;
正确写法:

 
#include<iostream>
using namespace std;
int main()
{
    cout<<"Hello,World!"<<endl;
    system("pause");
    return 0;
}
 


#include<iostream>
using namespace std;
int main()
{
    cout<<"Hello,World!";
    return 0;
}

大哥,这是C++,不是C
采纳下

https://blog.csdn.net/m0_67386172/article/details/125825772?spm=1001.2014.3001.5502
关于你的问题。。。

iostream
单词不对,是#include <iostream>
int main()中间怎么还多了个逗号
再增加#include <stdlib.h>

int main 中间咋有个逗号

到底是C还是C++??


 
#include<stdio.h>
//c语言
 
int main()
 
{
 
printf("helloword!\n");
 
return 0;
 
}
 
#include <iostream>
//c++
using namespace std;
 
int main() {
    cout << "Hello World!";
    return 0;
}