北京买房

来源:互联网 发布:怎样练好英语听力 知乎 编辑:程序博客网 时间:2024/04/27 18:52
<span style="color:#3333ff;">/*Copyright (c) 烟台大学计算机与控制工程学院Author:刘慧艳Created:2014.07.19Edition:V1.0Describe:北京买房*/#include <iostream>using namespace std;int main(){    double housePrice=200,salarys=40;    const double rate=0.1,salary=40;    int year=1;    while(year<80&&salarys<housePrice)    {        housePrice*=(1+rate);        salarys+=salary;        year++;        cout<<"第"<<year<<"房价是"<<housePrice<<"万,程序员有"<<salarys<<"万"<<endl;    }    if(housePrice<salarys)    cout<<"终于买上房了!哈哈"<<endl;    else    cout<<"一生飘萍无定所=-="<<endl;    return 0;}</span>

0 0
原创粉丝点击