我碰到了一个C++问题,不知道如何写hello基本代码
void main()
{
printf("码农谷,hello world!");
}
正如上面代码,printf属于C的内容,cout属于C++,但是C++全面支持C都内容,只需包含相应的头文件
#include
int main()
{
std::cout << "hello world\n";
return 0;
}
#include <stdio.h>
#include <iostream>
int main()
{
printf("码农谷,hello world!");//C语言版
std::cout<<"码农谷,hello world!"<<std::endl;//C++版
return 0;
}
#include
void main()
{
std::cout << ("码农谷,hello world!");
}