Guest User

Untitled

a guest
Jan 15th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.49 KB | None | 0 0
  1. // Nicholas Hunter (1100078)
  2. // August 29th, 2012
  3. // Programming 1 - Individual Assessment #3
  4. // Title: Game Score Report Generation System
  5. // Description: Testing data generated in this game system.
  6.  
  7. #include <stdio.h>
  8. #include <conio.h>
  9.  
  10. int main (void)
  11. {
  12.     // Declaraton variables required to produce stats for generated numbers in the game.
  13.    
  14.     char fullname[50];
  15.     float bet;
  16.     float amtwon;
  17.     float amtlost;
  18.     float totalwin;
  19.     int months;
  20.    
  21.    // Player is prompted to enter full name and bet amount.
  22.  
  23.     printf("Enter your full name: ");
  24.     scanf("%[^\n]s", &fullname);
  25.     fflush(stdin);
  26.     printf("\nPlace your bet amount: ");
  27.     scanf("%f", &bet);
  28.     if(bet <= 0)
  29.     {
  30.      printf("Invalid bet input!! Void outcome.\n");      
  31.            }
  32.    
  33.    // Calculating the total win, amount lost, and amount won.
  34.    
  35.     amtwon = ((bet*bet) / (bet*bet - 100 *bet)) * 25000;
  36.     amtlost = bet * .35;
  37.     totalwin = amtwon - amtlost;
  38.     months = totalwin / 5000 + 1;
  39.    
  40.     // Game card is then displayed, showing player's full name and total winnings.
  41.    
  42.    
  43.     printf("\n**************************************************\n** PLAYER: %s \t\t\t\t**", fullname);
  44.     printf("\n** Amount Won: JA$ %.2f\t\t\t**", amtwon);
  45.     printf("\n** Amount Lost: JA$ %.2f\t\t\t**", amtlost);
  46.     printf("\n** Total Winnings: JA$ %.2f [ %d Months ]    ** \n**************************************************", totalwin, months);
  47.    
  48.     getch();
  49.     }
Add Comment
Please, Sign In to add comment