Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

C#
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.


getch();
return 0;
}
Posted

1 solution

C#
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.
}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900