Click here to Skip to main content
12,944,121 members (53,331 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I'm trying to print the currency symbol in my final calculation. Someone please offer some assistance?

I've been browsing around for examples, however most seems complex for my new learning of programming.

Kindly assist me, thank you.

Here's what my program looks like:

main ()

    char f_name[20], l_name[20], m_name[20];                                   //Character for the players full name is assigned here.
   float bet, amt_won, amt_lost, total_win;                                    //variables to be used in the calaculation are defined here.

   printf("Enter your first name:\t");                                         //Player is promted to input first name.
   scanf("%s", &f_name);
   printf("\nEnter your middle name:\t");                            // Middle name is entered
   scanf("%s", &m_name);                                             // Middle name is accepted.
   printf("\nEnter your last name:\t");                                 //Last name is entered.
   scanf("%s", &l_name);                                             // Last name is accepted.
       printf("\nHow much money would you like to bet?\t");               //Bet amount is asked to be placed.
       scanf("%f", &bet);                                                 //Bet amount is accepted here.

   amt_won=(bet*bet)/((bet*bet)-100*bet)* 25000;                           //Amount of money to be woned is calculated.

   amt_lost = (0.35) * bet;                                                    //Amount of money lost during the gambles is accounted.

   total_win = amt_won - amt_lost;                                            //Total winnings of the end of the game is equated.

      printf("\nPLAYER: \t%s\t%s\t%s\n", f_name, m_name, l_name);                 //Players profile is displayed at the end of the game play.
      printf("Total Winnings:\t %f", total_win);                                //Total earnings from the gamble is showed at the end.

return 0;
Posted 14-Nov-12 14:35pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

printf("Enter your first name:\t");                                         //Player is promted to input first name.
   scanf("%s", &f_name);
   the '&' you should be missing,because the array name is the address of the first,scanf("%s",f_name),you should learn the array in c,the following is the same situation.good luckly.
   I'am also a new programer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,653
CHill60 2,970
Maciej Los 2,388
Jochen Arndt 1,900
ppolymorphe 1,765

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100