【题目链接】

ybt 1001:Hello,World!
洛谷 B2002 Hello,World!

【题目考点】

  1. 引入万能头文件 #include <bits/stdc++.h
  2. 使用命名空间std using namespace std
  3. 主函数写法,并且要写主函数的返回值
  4. 字符串常量,由双引号" "包含起来的是字符串常量。其实际类型为char*,是字符数组,存放于常量区。
  5. cout输出:cout后面接<<再接要输出的内容。
  6. printf输出字符串:printf(要输出的字符串)

【题解代码】

解法1:使用cout输出
#include <bits/stdc++.h>
using namespace std;

int main()
{
	cout << "Hello,World!";
    return 0;
}
解法2:使用printf输出
#include <bits/stdc++.h>
using namespace std;

int main()
{
	printf("Hello,World!");
    return 0;
}
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐