2 like 0 dislike
5.7k views
請寫一個程式,輸入任意字元,程式會輸出該字元相對應的十進位ASCII碼

輸入說明:

程式每次會輸入一個字元

輸出說明:

對於輸入的字元,請輸出相對應的十進位ASCII碼

輸入範例:

0

輸出範例

48
[Exercise] Coding (C) - asked in 2017-1 程式設計(一)AD by (18k points)
ID: 31094 - Available when: Unlimited - Due to: Unlimited

edited by | 5.7k views

29 Answers

0 like 0 dislike
Hidden content!
* *** * * ** **
int main()
{
** *** * a;
* * ** ******** *
*** ** * * ** *** **** *
** ** * 0 ;
}
answered by (236 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(){
* ** *** ** ** * * c;
** * * * ** * * * ** ** *** *** ** **
* * **** ** ** * ****** * * ** * * ****
** ** ** *** **** * * 0;
}
answered by (212 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(){
*** *** * * ** ** * ****** * c;
* ***** * * ** * ** * *
* * *** *** ***** * ** ** * *
*** * ** * **** * *** ** 0;
}
answered by (194 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
** ****** ** ** c;
** * * * ** *** ** * * * * ***** *
* * ** * ** * * ******* * ****** ****
** *** ** ** * * **** * **** ***** *

*** *** * **** *** ** 0 ;
}
answered by (194 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
* * * * ***** *
int main()
{
** ******** * * * * c;
* ** ** * * ** *** * * ** * ***** * * * * * *******

**** ** * ** ** ** *** * * * * ****

  
 
**** ** * * ** ** 0 ;
}
answered by (194 points)
0 0
prog.c: In function 'main':
prog.c:5:11: warning: too many arguments for format [-Wformat-extra-args]
    printf("\xe7\xa8\x8b\xe5\xbc\x8f\xe6\xaf\x8f\xe6\xac\xa1\xe6\x9c\x83\xe8\xbc\xb8\xe5\x85\xa5\xe4\xb8\x80\xe5\x80\x8b\xe5\xad\x97\xe5\x85\x83",c);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 like 0 dislike
Hidden content!
***** * * ** ** *
int main()
{
** ** **** * * * c;
* * ** ** * ***** * * * ** **** *** *
* ** * * * * * *
*** ** * **** ** * * *


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

}
answered by (194 points)
0 0
prog.c: In function 'main':
prog.c:6:5: warning: implicit declaration of function 'getch' [-Wimplicit-function-declaration]
   c=getch();
     ^~~~~
/tmp/ccnbCj2o.o: In function `main':
prog.c:(.text+0x1f): undefined reference to `getch'
collect2: error: ld returned 1 exit status
0 like 0 dislike
Hidden content!
#include<stdio.h>
***** ** ** ** * *
int main()
{
* ***** ** * ** * ** * * ** c;
* **** *** * * * *** ** * ** ** ** *
**** * *** ** **** * ** *** **
** ** ** *** * * ** ****** 0;
}
answered by (100 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
* * **** ** ** ****

int main()
{
* ***** * * * c;
* * * *** **** * * ** ***
****** * * ** **
**** * * ** *** ** **** *** * *


}
answered by (174 points)
edited by
0 0
prog.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
0 0
prog.c: In function 'main':
prog.c:6:12: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
    scanf("%c",&c);
            ^
0 0
prog.c: In function 'main':
prog.c:6:12: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
    scanf("%c",&c);
            ^
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
* * ** * *** * * ** ch;
* * ****** *** * *** *
*** ** * ** * ** ***** * **** character:");
** **** * ** * * *** **** * * * * * ** * ****
** * ** * **** * ****
** *** * *** *** * * * * * and its ASCII code is %d\n",ch,ch);
***** * **** *** **
** * * * * *
*** * *** *** *** ** 0 ;
* *** *** ** ** *
* * * *** * ** **
* ** * * * *** * ******
answered by (194 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
** * ******** ***
int * *
{
** ** * * ** *** char ch;
** ** ** ch = * **
****** **** ** ** * ** * *** * * * *** ;
***** * * * * * 0;
* *** **
answered by (228 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.6.110
©2016-2025

Related questions

2 like 0 dislike
31 answers
[Exercise] Coding (C) - asked Nov 9, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 31088 - Available when: Unlimited - Due to: Unlimited
| 6.1k views
2 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Nov 9, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 31085 - Available when: Unlimited - Due to: Unlimited
| 4.1k views
3 like 0 dislike
9 answers
[Exercise] True/False - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 33764 - Available when: 2017-11-16 14:00 - Due to: 2017-11-16 14:30
| 952 views
3 like 0 dislike
9 answers
[Exercise] True/False - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 33763 - Available when: 2017-11-16 14:00 - Due to: 2017-11-16 14:30
| 881 views
2 like 0 dislike
24 answers
[Exercise] Coding (C) - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 33762 - Available when: Unlimited - Due to: Unlimited
| 4.3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users