update in class
This commit is contained in:
parent
4dc7afa499
commit
867bdc0109
33
class/calc.cpp
Normal file
33
class/calc.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include<iostream>
|
||||
#include<windows.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
int main(){
|
||||
int range = 0;
|
||||
while (range != 5)
|
||||
{
|
||||
int a,s;
|
||||
cin >>a;
|
||||
|
||||
s = a * a;
|
||||
|
||||
cout <<"结果:"<<s<<endl;
|
||||
range++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
int main(){
|
||||
int time = 15;
|
||||
while (time > 0)
|
||||
{
|
||||
cout <<"你还剩"<<time<<"分钟"<<endl;
|
||||
Sleep(60000);
|
||||
time--;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -4,7 +4,9 @@
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
int tree = 17,wn = 0,clim = 3,down = 1,time = 0;
|
||||
int tree,wn = 0,clim = 3,time = 0;
|
||||
|
||||
cin >> tree;
|
||||
|
||||
while (wn < tree)
|
||||
{
|
||||
@ -16,11 +18,11 @@ int main(){
|
||||
break;
|
||||
}
|
||||
|
||||
wn -= down;
|
||||
wn--;
|
||||
time++;
|
||||
}
|
||||
|
||||
cout <<time<<endl;
|
||||
cout <<"需要"<<time<<" 分钟才能爬到树顶"<<endl;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*某邮局对邮寄包裹有如下规定:若包裹的重量超过30千克,则不予邮寄,对可以邮寄的包裹每件收取手续费0.2元,再加上根据以下收费标准计算的结果。收费标准(元/千克)
|
||||
重量(千克)
|
||||
重量<=100.8010<重量<=200.750.7
|
||||
20<重量<=30
|
||||
请编写一个程序,输入包裹重量,输出所需费用或“Fail”表示无法邮寄*/
|
||||
#include<iostream>
|
||||
#include<windows.h>
|
||||
#include<iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
float CIN,money;
|
||||
|
||||
cin >>CIN;
|
||||
|
||||
if (CIN <= 10)
|
||||
{
|
||||
money = CIN * 0.80 + 0.20;
|
||||
cout <<fixed<<setprecision(2)<<money;
|
||||
Sleep(2000);
|
||||
return 0;
|
||||
}else if (CIN > 10 and CIN <= 20)
|
||||
{
|
||||
money = CIN * 0.75 + 0.20;
|
||||
cout <<fixed<<setprecision(2)<<money;
|
||||
Sleep(2000);
|
||||
return 0;
|
||||
}else if (CIN > 20 and CIN <=30)
|
||||
{
|
||||
money = CIN * 0.7 + 0.20;
|
||||
cout <<fixed<<setprecision(2)<<money;
|
||||
Sleep(2000);
|
||||
return 0;
|
||||
}else
|
||||
{
|
||||
cout <<"Fail!";
|
||||
Sleep(2000);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
42
old_homework/11.15.cpp
Normal file
42
old_homework/11.15.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*某邮局对邮寄包裹有如下规定:若包裹的重量超过30千克,则不予邮寄,对可以邮寄的包裹每件收取手续费0.2元,再加上根据以下收费标准计算的结果。收费标准(元/千克)
|
||||
重量(千克)
|
||||
重量<=100.8010<重量<=200.750.7
|
||||
20<重量<=30
|
||||
请编写一个程序,输入包裹重量,输出所需费用或“Fail”表示无法邮寄*/
|
||||
#include<iostream>
|
||||
#include<windows.h>
|
||||
#include<iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
float CIN,money;
|
||||
|
||||
cin >>CIN;
|
||||
|
||||
if (CIN <= 10)
|
||||
{
|
||||
money = CIN * 0.80 + 0.20;
|
||||
cout <<fixed<<setprecision(2)<<money;
|
||||
Sleep(2000);
|
||||
return 0;
|
||||
}else if (CIN > 10 and CIN <= 20)
|
||||
{
|
||||
money = CIN * 0.75 + 0.20;
|
||||
cout <<fixed<<setprecision(2)<<money;
|
||||
Sleep(2000);
|
||||
return 0;
|
||||
}else if (CIN > 20 and CIN <=30)
|
||||
{
|
||||
money = CIN * 0.7 + 0.20;
|
||||
cout <<fixed<<setprecision(2)<<money;
|
||||
Sleep(2000);
|
||||
return 0;
|
||||
}else
|
||||
{
|
||||
cout <<"Fail!";
|
||||
Sleep(2000);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user