01:Hello, World!
python编程
print("Hello, World!")
C++编程
#include<iostream> using namespace std; int main() { cout<<"Hello, World!"<<endl; }
02:输出第二个整数
python编程
a, b, c = map(int, input().split()) print(b)
C++编程
#include<iostream> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; cout<<b<<endl; return 0; }
03:对齐输出
python编程
a, b, c = map(int, input().split()) print(format(a, '>8'), format(b, '>8'), format(c, '>8'))
C++编程
#include<iostream> #include<iomanip> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; cout << setw(8) <<right << a << " " << setw(8) <<right << b << " "<< setw(8) <<right << c; cout << endl; }
04:输出保留3位小数点浮点数
python编程