NOI / 1.1编程基础之输入输出
01:Hello, World!
答:
#include<bits/stdc++.h>
using namespace std;
int main(){
cout<<"Hello, World!";
return 0;
}
02:输出第二个整数
答:
#include<iostream>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
cout<<b;
return 0;
}
03:对齐输出
答:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
// 可以三行合并为一行写完,不过太长了
cout << setw(8) << a << ' ';
cout << setw(8) << b << ' ';
cout << setw(8) << c;
return 0;
}
04:输出保留3位小数的浮点数
答