#include <bits/stdc++.h>
using namespace std;
int main() {
// 输出
cout<<"hello"<<endl;
cout<<1+2<<endl;
cout<<((4+6)*5+7)*3<<endl; //都是用小括号
cout<<5/3<<endl; //1 商
cout<<5%3<<endl; //2 余数
cout<<1.0/3<<endl; //0.333...
cout<<fixed<<setprecision(2)<<1.0/3<<endl; //输出2位小数
cout<<2025<<" "<<2026<<endl; // 空格隔开两个数
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
// 输入 cin
int a; //定义一个整数a
cin>>a; //读入a
cout<<a*a<<endl; //输出a的平方
double b, c; //浮点数 带小数点的数
cin>>b>>c;
cout<<fixed<<setprecision(4)<<b/c<<endl;
char e; //符号 字符 就一个符号
e='a'; //符号用单引号括住 字符的a在计算机中存储用数字97表示
cout<<e<<endl; //输出 a
cout<<e+1<<endl; //输出 98
cout<<(char)(e+1)<<endl; //输出b 类型转换为char类型
double h = 9.9;
cout<<(int)h <<endl; //转化为int类型
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
bool x=5>3; //true 1 //false 0
cout<<x<<endl; //真的 输出1
//判断相等用 两个等于号
// || 或者 && 并且 !非
bool y = 3 < 1 || 2==2; // 3<1 或者 2等于2
/*
if (条件 计算出真假 0假 非0真) {
满足条件执行的语句
}
*/
if (3>2) {
cout<<"good"<<endl;
cout<<"hello"<<endl;
} else {
cout<<"2>3"<<endl;
}
int u = 32, v=40; //两个数 从大到小输出
if (u<v) {
cout<<v<<" "<<u<<endl;
} else {
cout<<u<<" "<<v<<endl;
}
//如何求若干个数的最大值 a1,a2,a3,a4,a5
int a1=3, a2=9, a3=8, a4=16, a5=7;
int m=a1;
if (a2>m) m=a2;
if (a3>m) m=a3;
if (a4>m) m=a4;
if (a5>m) m=a5;
int s=0;
s=s+a1;
s=s+a2;
s=s+a3;
s=s+a4;
s=s+a5;
return 0;
}