信息学奥赛一本通 1001:Hello,World | 洛谷 B2002 Hello,World!
一. 题目链接ybt 1001:Hello,World!OpenJudge NOI 1.1 01:Hello, World!二. 题目考点引入万能头文件 #include <bits/stdc++.h使用命名空间std using namespace std主函数写法,并且要写主函数的返回值字符串常量,由双引号" "包含起来的是字符串常量。其实际类型为char*,是字符数组,存放于常量区。c
·
【题目链接】
ybt 1001:Hello,World!
洛谷 B2002 Hello,World!
【题目考点】
- 引入万能头文件
#include <bits/stdc++.h
- 使用命名空间std
using namespace std
- 主函数写法,并且要写主函数的返回值
- 字符串常量,由双引号" "包含起来的是字符串常量。其实际类型为char*,是字符数组,存放于常量区。
- cout输出:cout后面接<<再接要输出的内容。
- 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;
}
更多推荐
所有评论(0)