PX-32-银行盗窃

//对剩余金额的判断

#define
_CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> void main1() { double db = 1.2344; printf("%.2f", db);//只显示小数点后面两位 getchar(); } //1.23 //1.20 //1.23 *10 12.3 +0.6=12.9 12 12.0 1.2 //1.24 //1.24 //1.24*10 12.4+0.6 =13 1.3 //小数点后三位实现四舍五入 void main() { double money=0; scanf("%lf", &money); //scanf %lf对应double printf("有%f元", money); double res = (int)(money * 10 + 0.6) / 10.0; printf("\nres=%f", res); if (res <money) { printf("可以盗窃%f元", money - res); //转账 } system("pause"); }

 

posted @ 2016-12-15 11:29  silvercell  阅读(785)  评论(0)    收藏  举报