柯本气候分类法的 C++实现

#include<bits/stdc++.h>
using namespace std;
int main() {
	cout << "请依次输入MAP, MAT, Thot, Tcold, Tmon10, Pdry, Psdry, Pwdry, Pswet, Pwwet, Pthreshold:" << endl;
	double MAP, MAT, Thot, Tcold, Tmon10, Pdry, Psdry, Pwdry, Pswet, Pwwet, Pthreshold;
	cin >> MAP >> MAT >> Thot >> Tcold >> Tmon10 >> Pdry >> Psdry >> Pwdry >> Pswet >> Pwwet >> Pthreshold;
	 if (MAP < 10 * Pthreshold) {	//先判断是不是干带
		if (MAP < 5 * Pthreshold) {
			if (MAT >= 18) {
				cout << "BWh";
			}
			else {
				cout << "BWk";
			}
		}
		else {
			if (MAT >= 18) {
				cout << "BSh";
			}
			else {
				cout << "BSk";
			}
		}
	 }
	else if (Tcold >= 18) {
		if (Pdry >= 60) {
			cout << "Af";

		}
		else if (Pdry >= 100 - MAP / 25) {
			cout << "Am";
		}
		else {
			cout << "Aw";
		}
	}
	else if (Thot > 10 && Tcold > 0 && Tcold < 18) {
		 if (Psdry < 40 && Psdry < Pwwet / 3 && Pwdry < Pswet / 10) {
			 double summer_precipitation, winter_precipitation;
			 cout << "请输入夏半年降水量:" << endl;
			 cin >> summer_precipitation;
			 cout << "请输入冬半年降水量:" << endl;
			 cin >> winter_precipitation;
			 if (summer_precipitation > winter_precipitation) {
				 if (Thot >= 22) {
					 cout << "Cwa";
				 }
				 else if (Tmon10 >= 4) {
					 cout << "Cwb";
				 }
				 else if (Tmon10 >= 1 && Tmon10 < 4) {
					 cout << "Cwc";
				 }
			 }
			 else {
				 if (Thot >= 22) {
					 cout << "Csa";
				 }
				 else if (Tmon10 >= 4) {
					 cout << "Csb";
				 }
				 else if (Tmon10 >= 1 && Tmon10 < 4) {
					 cout << "Csc";
				 }
			 }
		 }
		else if (Psdry < 40 && Psdry < Pwwet / 3) {
			if (Thot >= 22) {
				cout << "Csa";
			}
			else if (Tmon10 >= 4) {
				cout << "Csb";
			}
			else if (Tmon10 >= 1 && Tmon10 < 4) {
				cout << "Csc";
			}
		}
		else if (Pwdry < Pswet / 10) {
			if (Thot >= 22) {
				cout << "Cwa";
			}
			else if (Tmon10 >= 4) {
				cout << "Cwb";
			}
			else if (Tmon10 >= 1 && Tmon10 < 4) {
				cout << "Cwc";
			}
		}
		else {
			if (Thot >= 22) {
				cout << "Cfa";
			}
			else if (Tmon10 >= 4) {
				cout << "Cfb";
			}
			else if(Tmon10 >= 1 && Tmon10 < 4) {
				cout << "Cfc";
			}
		}
	}
	else if (Thot > 10 && Tcold <= 0) {
		 if (Psdry < 40 && Psdry < Pwwet / 3 && Pwdry < Pswet / 10) {
			 double summer_precipitation, winter_precipitation;
			 cout << "请输入夏半年降水量:" << endl;
			 cin >> summer_precipitation;
			 cout << "请输入冬半年降水量:" << endl;
			 cin >> winter_precipitation;
			 if (summer_precipitation > winter_precipitation) {
				 if (Thot >= 22) {
					 cout << "Dwa";
				 }
				 else if (Tmon10 >= 4) {
					 cout << "Dwb";
				 }
				 else if (Tcold < -38) {
					 cout << "Dwd";
				 }
				 else {
					 cout << "Dwc";
				 }
			 }
			 else {
				 if (Thot >= 22) {
					 cout << "Dsa";
				 }
				 else if (Tmon10 >= 4) {
					 cout << "Dsb";
				 }
				 else if (Tcold < -38) {
					 cout << "Dsd";
				 }
				 else {
					 cout << "Dsc";
				 }
			 }
		 }
		else if (Psdry < 40 && Psdry < Pwwet / 3) {
			if (Thot >= 22) {
				cout << "Dsa";
			}
			else if (Tmon10 >= 4) {
				cout << "Dsb";
			}
			else if (Tcold < -38) {
				cout << "Dsd";
			}
			else {
				cout << "Dsc";
			}
		}
		else if (Pwdry < Pswet / 10) {
			if (Thot >= 22) {
				cout << "Dwa";
			}
			else if (Tmon10 >= 4) {
				cout << "Dwb";
			}
			else if (Tcold < -38) {
				cout << "Dwd";
			}
			else {
				cout << "Dwc";
			}
		}
		else {
			if (Thot >= 22) {
				cout << "Dfa";
			}
			else if (Tmon10 >= 4) {
				cout << "Dfb";
			}
			else if (Tcold < -38) {
				cout << "Dfd";
			}
			else {
				cout << "Dfc";
			}
		}
	}
	else if (Thot < 10) {
		if (Thot > 0) {
			cout << "ET";
		}
		else if (Thot <= 0) {
			cout << "EF";
		}
	}
}
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值