如何在C中显示货币符号? [英] How to display currency symbol in C?

查看:258
本文介绍了如何在C中显示货币符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在最终计算中打印货币符号.有人可以提供帮助吗?

我一直在浏览示例,但是对于我的编程新知识来说,大多数似乎都很复杂.

请帮助我,谢谢.

这是我的程序的样子:

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.


getch();
return 0;
}

推荐答案

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.
}


这篇关于如何在C中显示货币符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆