C/C++第一个程序:Hello World!

C语言:

首先需要导入头文件,然后在main()里面写入程序:

#include <stdio.h>

int main(){
    printf("hello world!\n你好世界!\n");
    return 0;
}

如果出现闪退问题,就加上:

system("pause"); 

#include <stdio.h>
#include <stdlib.h>

int main(){
    printf("hello world!\n你好世界!\n");
    system("pause");
    return 0;
}

 C++:

#include<iostream>
using namespace std;
int main()
{
    cout<<"Hello world.\n你好世界.\n";
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_51995147/article/details/128442918