#include <stdio.h>
typedef struct{
int accNum;
double bal;
}BankAcc;
double sim_pow(double base, int year){
int i;
double r = 1.0;
for(i=0; i<year; i++){
r = r*base;
}
return r;
}
void initAcc(BankAcc *acc, int x, double y){
acc -> accNum = x;
acc -> bal = y;
}
void xxx(BankAcc *acc, double *en){
if (*en > 0 && *en < acc -> bal) {
acc -> bal = acc -> bal-*en;
}else{
acc -> bal = acc -> bal+*en;
}
}
void yyy(BankAcc *acc){
acc -> bal = acc -> bal * sim_pow((1+0.1),3);
}
int main(){
BankAcc myAcc;
initAcc(&myAcc, 9981, 2200.0);
double amount = 100.0;
xxx(&myAcc, &amount);
yyy(&myAcc);
printf("%d and %.2f", myAcc.
accNum, myAcc.
bal); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiAKIAp0eXBlZGVmIHN0cnVjdHsKICAgIGludCBhY2NOdW07CiAgICBkb3VibGUgYmFsOwp9QmFua0FjYzsKIAogCiAKZG91YmxlIHNpbV9wb3coZG91YmxlIGJhc2UsIGludCB5ZWFyKXsKICAgIGludCBpOwogICAgZG91YmxlIHIgPSAxLjA7CiAKICAgIGZvcihpPTA7IGk8eWVhcjsgaSsrKXsKICAgICAgICByID0gcipiYXNlOwogICAgfQogICAgcmV0dXJuIHI7Cn0gCiAKIAogCnZvaWQgaW5pdEFjYyhCYW5rQWNjICphY2MsIGludCB4LCBkb3VibGUgeSl7CiAgICBhY2MgLT4gYWNjTnVtID0geDsKICAgIGFjYyAtPiBiYWwgPSB5Owp9CiAKIAogCnZvaWQgeHh4KEJhbmtBY2MgKmFjYywgZG91YmxlICplbil7CiAgICBpZiAoKmVuID4gMCAmJiAqZW4gPCBhY2MgLT4gYmFsKSB7CiAgICAgICAgYWNjIC0+IGJhbCA9IGFjYyAtPiBiYWwtKmVuOwogICAgfWVsc2V7CiAgICAgICAgYWNjIC0+IGJhbCA9IGFjYyAtPiBiYWwrKmVuOwogICAgfQp9CiAKIAogCnZvaWQgeXl5KEJhbmtBY2MgKmFjYyl7CiAgICBhY2MgLT4gYmFsID0gYWNjIC0+IGJhbCAqIHNpbV9wb3coKDErMC4xKSwzKTsKfQogCiAKaW50IG1haW4oKXsKIAogICAgQmFua0FjYyBteUFjYzsKICAgIGluaXRBY2MoJm15QWNjLCA5OTgxLCAyMjAwLjApOwogICAgZG91YmxlIGFtb3VudCA9IDEwMC4wOwogICAgeHh4KCZteUFjYywgJmFtb3VudCk7CiAgICB5eXkoJm15QWNjKTsKICAgIHByaW50ZigiJWQgYW5kICUuMmYiLCBteUFjYy5hY2NOdW0sIG15QWNjLmJhbCk7CiAgICByZXR1cm4gMDsKIAp9