Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Nicholas Hunter (1100078)
- // August 29th, 2012
- // Programming 1 - Individual Assessment #3
- // Title: Game Score Report Generation System
- // Description: Testing data generated in this game system.
- #include <stdio.h>
- #include <conio.h>
- int main (void)
- {
- // Declaraton variables required to produce stats for generated numbers in the game.
- char fullname[50];
- float bet;
- float amtwon;
- float amtlost;
- float totalwin;
- int months;
- // Player is prompted to enter full name and bet amount.
- printf("Enter your full name: ");
- scanf("%[^\n]s", &fullname);
- fflush(stdin);
- printf("\nPlace your bet amount: ");
- scanf("%f", &bet);
- if(bet <= 0)
- {
- printf("Invalid bet input!! Void outcome.\n");
- }
- // Calculating the total win, amount lost, and amount won.
- amtwon = ((bet*bet) / (bet*bet - 100 *bet)) * 25000;
- amtlost = bet * .35;
- totalwin = amtwon - amtlost;
- months = totalwin / 5000 + 1;
- // Game card is then displayed, showing player's full name and total winnings.
- printf("\n**************************************************\n** PLAYER: %s \t\t\t\t**", fullname);
- printf("\n** Amount Won: JA$ %.2f\t\t\t**", amtwon);
- printf("\n** Amount Lost: JA$ %.2f\t\t\t**", amtlost);
- printf("\n** Total Winnings: JA$ %.2f [ %d Months ] ** \n**************************************************", totalwin, months);
- getch();
- }
Add Comment
Please, Sign In to add comment