根据用户选择进行计算

#include <stdio.h> 
int main() { 
   int iSelection = 0; 
   float fTransAmount = 0.0; 
   float fBalance = 100.25; 

   printf(1\tDeposit Funds\n); 
   printf(2\tWithdraw Funds\n); 
   printf(Enter your selection: ); 
   scanf(%d, &iSelection); 

   if (iSelection == 1) { 
      printf(\nEnter fund amount to deposit: ); 
      scanf(%f, &fTransAmount);  
      printf(\nYour new balance is: $%.2f\n, fBalance + fTransAmount); 
   }
   if (iSelection == 2) { 
      printf(\nEnter fund amount to withdraw: ); 
      scanf(%f, &fTransAmount); 
      if (fTransAmount > fBalance) 
         printf(\nInsufficient funds\n); 
      else 
         printf(\nYour new balance is $%.2f\n, fBalance - fTransAmount); 
   }
}

相关文章

for遍历数组
。。。
声明一个计数循环
咕咕咕
#include <stdio.h> int main (void) { printf (&quo...