我将如何转换为国际数字系统 [英] How would I convert into international system of numbers

查看:64
本文介绍了我将如何转换为国际数字系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个程序,用印数字格式将数字从整数转换为英文,我不确定如何将其转换为国际系统,任何建议?



I made a program to convert numbers from integer to english in Indian Number format, I am unsure how would I convert this to international system, Any suggestions ??

#include<stdio.h>
#include<conio.h>

void convert(long,char[]);

char *one[]={" "," one"," two"," three"," four"," five"," six"," seven","eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","seventy"," eighty"," ninety"};


void main()
{
 long n;
 clrscr();
 printf("Enter any 9 digit no: ");
 scanf("%9ld",&n);
 if(n<=0)
                printf("Enter numbers greater than 0");
 else
 {
                  convert((n/10000000),"crore");
                  convert(((n/100000)%100),"lakh");
                  convert(((n/1000)%100),"thousand");
                  convert(((n/100)%10),"hundred");
                  convert((n%100)," ");
 }
 getch();
}


void convert(long n,char ch[])
{
 (n>19)?printf("%s %s ",ten[n/10],one[n%10]):printf("%s ",one[n]);
 if(n)printf("%s ",ch);
}





我的尝试:



我试图改变一些值,但我无法这样做



What I have tried:

I tried to change some values but i am unable to do so

推荐答案

如果你写了 - 相当差的代码,你应该能够自己做这件事:这不是一个复杂的变化。



如果你从别人那里复制'n'pasted代码,那么先从阅读它,学习它是如何工作的,然后考虑修改:或者更好,把它扔掉,然后自己编写 - 你不会学到很多东西或者确实需要复制任何东西,这意味着你们在下一个作业任务中都会有更难的工作,可能考试不及格。
If you wrote that - pretty poor - code, you should be able to do this yourself: it's not a complex change.

If you copy'n'pasted that code from someone else, then start by reading it, learning how it works, and then thinking about modifications: or better, throw it away, and write your own - you won't learn much or indeed anything for copying, and that means you will both have an even harder job with the next homework task, and probably fail the course when it comes to your exams.


这篇关于我将如何转换为国际数字系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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