3 喜歡 0 不喜歡
413 瀏覽
請寫一個程式,把輸入的阿拉伯數字轉成羅馬數字輸出。

羅馬數字的規則請參考

https://zh.wikipedia.org/wiki/%E7%BD%97%E9%A9%AC%E6%95%B0%E5%AD%97

輸入說明:

會輸入一個不超過1000的正整數

輸出說明:

請將相對於輸入數字的羅馬數字輸出

輸入範例:

14

輸出範例:

XIV
[練習] Coding (C) - 最新提問 分類:2017-1 程式設計(一)AD | 用戶: (18k 分)
ID: 34979 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 413 瀏覽

6 個回答

0 喜歡 0 不喜歡
內容已隱藏
****** * ** ****
* * ** * ** ** * * *****
int did(char a)
{
** ** * * **** ** * * 1;
** ** * ** * ** **** if(a=='V') return 5;
* ** ** ***** * if(a=='X') return 10;
** ** * ** * ** **** return 50;
* * ** ** ** ** ** * ** ** return 100;
* *** ******** * * * ** * return 500;
* * * * ** *** *** * ** return 1000;
* *** ****** *** * * *
*** * * *** * *** * 0;
}
int main()
{
** * * * * * int len,SUM1;
* * ** * int sum;
* **** * ***** * char s[1101];
** ** ** * *** *** * ** * * *
*** * * * * {
******** ** * *** * * **** sum = SUM1 = 0;
* * ** ** ** ** *** ** ** * len = ** **
**** ** ** * * * ** for(int i ** ** * **
* * ** * * * ** * * * * {
* * * * *** * * *** * * **** ** * *** **** **
* ** *** *** * * * * * * ** * * ** * * * * **** **** ** += SUM1;
*** *** ** * ** * *
* ** * * * ** *** }
****** ***** ** * * * ** * * ***** * ** * * *
**** * * ** * }
** *** * ** **** * ** ***** * ** **
}
最新回答 用戶: (236 分)
0 0
prog.c: In function 'main':
prog.c:5:1: error: stray '\343' in program
 \xe3\x80\x80\xe3\x80\x80char a[4002],b[4002];
 ^
prog.c:5:2: error: stray '\200' in program
 \xe3\x80\x80\xe3\x80\x80char a[4002],b[4002];
  ^
prog.c:5:3: error: stray '\200' in program
 \xe3\x80\x80\xe3\x80\x80char a[4002],b[4002];
   ^
prog.c:5:4: error: stray '\343' in program
 \xe3\x80\x80\xe3\x80\x80char a[4002],b[4002];
    ^
prog.c:5:5: error: stray '\200' in program
 \xe3\x80\x80\xe3\x80\x80char a[4002],b[4002];
     ^
prog.c:5:6: error: stray '\200' in program
 \xe3\x80\x80\xe3\x80\x80char a[4002],b[4002];
      ^
prog.c:6:15: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[4002]' [-Wformat=]
 while(scanf("%s",&a)!=EOF)
               ^
prog.c:10:9: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[4002]' [-Wformat=]
 scanf("%s",&b);
         ^
prog.c:136:9: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
 int sum=abs(suma-sumb);
         ^~~
0 0
Case 0: Wrong output
Case 1: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
* ** ** * * * *

int main()
{
* **** * *** ** *** ** a,i;
* *** * * **** ******* *
* * ** ** ** * * * ** * * * ** ****** ** *
* * * * * * * ** * **
**** * ** *** * ***
* * * * * *** **** * *** *** *** * * * * **
***** * * * * * ** ****
* ** * ** *** * ** ** * ** * *
*** *** ** * * * * ** * * * ** ***
    }    
*** * **** ***** *** * * if(a==4)
* * ** * * ** ** * ** ** *** * *********
* * * * * *** ** ** * *** **** ******** * * * * * **
***** * *** * *
    printf("V");
    * *** * * *** * * * *
*** * ** *** * * * * * ***
****** * * * ** *** * * * * ****
* * *** * * * ** ** **********
    }
    }
    else if(a==9)
* * * * ** * *** * * *** ** ** **
* ** * **** ** * ** * if(a==10)
* * * * ***** ** *** * *** * * *
* * **** * * * * **** if(a==50)
* *** ** * * * *** * * ** *
* * ** ** *** *** * ** * if(a==100)
** ** * * ** * * ** * ** * **
* * ***** * * ** * ** if(a==500)
** ** **** *** * * *** * ** * **
* * ** *** * * * *** * ** if(a==1000)
** *** ** ** * * * * ** ** * **
** * * ** ** * *
   
    return 0;
}
最新回答 用戶: (215 分)
修改於 用戶:
0 0
prog.c:1:1: error: expected identifier or '(' before '.' token
 .
 ^
0 0
Case 0: Wrong output
Case 1: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
* ** *** *** *
int main()
{
char *th[] = { ** ** **** ** **** * * **
char *hun[] = { * ** * * *** ** ** * **** * ** * ****** ** * *** * * * * * * * * **** ** * ** **** * ** ** ** ** * * ** ** * **** *** };
char *ten[] = { * ****** * * * *** ****** **** ** ** * * ** ** *** * * *** ** *** *** ** ** *** * * *** *** * * * ** };
char *one[] = { * * ** * ** * * * * ** * ****** * ** * * * * * * *** ** * * ** ** ** ** ** * ** ** * * ** ** * * * * * * ** *** ** ** ** * * * };
int input;

while( scanf( * *** * * *** ) != EOF )
* ** ** *** ** th[ * ** * ], hun[ * ** ** ], ten[ ** ], one[ ** ] ); * * *
* * 0;
}
最新回答 用戶: (100 分)
修改於 用戶:
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
0 喜歡 0 不喜歡
內容已隱藏
** ******** ** ***


int main()
{
char ** ***** = { *** * * *** ** ** * * ****** *** * * * };
char * = { ***** ** ** * *** **** ** ** * * * * * *** *** ******* *** *** * ** * ** * * * * *** ** * * * * * ** ** };
char *ten[] = { ** * ** * * * ** **** **** * ** ** **** * ****** * ** *** ** ******* * ** * * * * * * **** *** * * * ** * ** *** * ** * *** };
char *one[] = { ** * * * ** * * * * ** * *** *** * *** * ** * * * *** * * ** ** * * *** * * ** * * ** * * *** ** * * ** * * };

int input;

* * * * ** * );
printf( * * * ** * * thousand[ ** ], hundred[ * * ***** ], ten[ ** ** * * ], one[ input%10 ] );

return 0;
}
最新回答 用戶: (174 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
* * * * * ** **
int main()
{

** ** * char * * * * = { **** ** * * ********* ** ** * * * * ** ***** *** };
* *** char * ** = { *** * * *** *** *** ** * * ** *** ** * ****** *** **** *** * * * ** * * * ****** * * * *** * ** * * * * ** ** };
* **** *** char *ten[] = { *** * ** ** ***** ** ** ** * *** * * * ***** * * ** ** ** ** * * ** *** *** *** ***** ** ** * * * ** * * * * * *** };
** * * * char *one[] = { * *** **** *** **** * * **** * ** * ****** * ** ** * ** * * ***** * * **** * ** * * * * * ****** * * };

**** ** ** int n;

** * * * ** while( scanf( ** ** * ** * * * ) != EOF )
** *** *** * *** printf( **** * ** ** *** * ** n/1000 ], hundred[ * **** ], ten[ * * ], one[ n%10 ] );

return 0;
}
最新回答 用戶: (160 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * * * ** ** *


int main()
{

* * **** * * * *** ** thousand[2][5]={ ** ** ** * ** ** ** };
* * * ** ** ** * ** hundred[10][5]={ *** * ** ** *** * * * ** ***** * ** ** * ******* * **** ** * **** * * ** ***** * *** ** ******* * ** ** ** ** * * ** **** ** ** * * *** };
**** *** ** * * ***** ten[10][5]={ * * ** * * * ** * *** * ** * *** * ** ** *** * * * * ** *** * * * ** * *** ** * ** * * * ** ** *** ** * ***** * *** };
* *** ** * ******* *** one[10][5]={ ** * ****** ******** * * *** ** ** ******* **** * * ** **** * ** * **** * *** * ** * * * * * * * * ** * };

* **** * * * * ** *** input;
* * *** *** * *** * * ***** * * scanf( * * ** *** * * &input ) != EOF )
* ******* ** *** **** ******** ******* * ** * * * * *** ** * thousand[ input/1000 ], hundred[ (input/100)%10 ], ten[ (input/10)%10 ], one[ input%10 ] );

* ***** * * * ** ** ** 0;

}
最新回答
0 0
Case 0: Correct output
Case 1: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.178
©2016-2024

相關問題

3 喜歡 0 不喜歡
5 回答
[練習] Coding (C) - 最新提問 11月 30, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 34978 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 445 瀏覽
3 喜歡 0 不喜歡
20 回答
[練習] Coding (C) - 最新提問 11月 16, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 33758 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.1k 瀏覽
3 喜歡 0 不喜歡
14 回答
[練習] 多選題 - 最新提問 11月 30, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 34985 - 從幾時開始: 2017-11-30 14:00 - 到幾時結束: 2017-11-30 14:30
| 398 瀏覽
2 喜歡 0 不喜歡
24 回答
[練習] Coding (C) - 最新提問 11月 16, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 33762 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 969 瀏覽
3 喜歡 0 不喜歡
22 回答
[練習] Coding (C) - 最新提問 11月 16, 2017 分類:2017-1 程式設計(一)AD | 用戶: Shun-Po (18k 分)
ID: 33757 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.2k 瀏覽
12,783 問題
183,443 回答
172,219 留言
4,824 用戶