Daphne 以10%的单利息投资了100美元(也就是说,每年投资赢得的利息等于原始投资的10%)。 Deirdre 则以每年5%的复合利息投资了100美元(也就是说,利息是当前结余的5%,其中包括以

#include "stdafx.h"
#include "stdlib.h"
 
int main()  
{  
    int years;
    const double BASE=100.0;
    double daphone,deirdre;
 
    daphone=BASE;
    deirdre=BASE;
    years=0;
 
    while(daphone>=deirdre)
    {
        daphone+=BASE*0.1;
        deirdre+=deirdre*0.05;
        years++;
    }
 
    printf("%dYears\t%0.2f\t%0.2f\n",years,daphone,deirdre);
 
    system("pause");
    return 0;  
}

你可能感兴趣的:(System,include)