2 like 0 dislike
9.2k 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 | 9.2k views

29 Answers

0 like 0 dislike
Hidden content!
** *** ********* *** *

int * * *****
{
* * * *** int c;

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

* * * ** * return 0;
* * **
answered by (160 points)
0 0
prog.c: In function 'main':
prog.c:7:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&c);
          ^
0 like 0 dislike
Hidden content!
** * * * * ** **

int ** ** *
{
* *** * **** * int ch;
* *** * * * *** * * * * * ** *
* * *** *** * * * * ** * *
* * * *** ****** * ** ** *
* **** *  
** *  
** * * ** ** * return 0;
****
answered by (160 points)
0 0
prog.c: In function 'main':
prog.c:7:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
0 like 0 dislike
Hidden content!
** * * * *** * ***

int main(void)
{
** ** *** *** * ** *** **** c;
*** * * * * ** ** * ** ** * &c);
***** *** * ** ** ** * ** ** * ** ** c);
*** * *** * ** **** ** ** 0;
}
answered by (138 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 ** * ** * * *

int main (void)
{
** *** * ** ** c;
** * * ***** * *** * ** ***** **** * ******
** * * *** * ****** * ******** * ** ** *
* * ** * * * *** * 0;
}
answered by (144 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 (void)
{
* * * *** ** ** * * ** c;
* ** ** ***** **** **** * **** * * * **
**** * *** *** * * * * * * * * * * * * ** ** *
* ** * * ***** * * ** * *** * ** * * ** *
*** * ** * * * * *** *** 0;
}
answered by (144 points)
0 0
prog.c: In function 'main':
prog.c:8:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include ** *** *** * *

int main()
{
*** * * * ******* ** * * a[2];
* ** ** ***** * * **** * * * * * **** * ** **
* *** * ** ** ** *
** * * ******* **** ** * ** ** * * ** ************ *

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

** * ** * * ** *** ** 0;
}
answered by (114 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 ***** * * **** *
int main ()
{
** *** * * * * * ** *** * ch;

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

** ******* * ** 0;
}
answered by (215 points)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
-----------Re-judge-----------
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 ()
{
* *** *** * *** * **** * *** ch;

* *** *** * * *** ** ** * * * *** * ** * * ***
*** * * * * * * * * **** * **** * ** * ***
** *** ** * *** *
* **** ******* * * ** * * *** ***** * * * * *
********* * *** 0;
}
answered by (215 points)
0 0
prog.c: In function 'main':
prog.c:9:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main ()
{
** * ** * * * * **** * ch;

*** * **** *** ***** *** ** * * *** * **** * * ** *
* ** **** ** *** * ** * * * *** ** **
***** * **** ** ** * * * ***
** ** *** **** *** * *** ** * * 0;
}
answered by (215 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(void)
{
* ** *** *** * * * ch;
** ** * * * * *
**** * ** * * ** * * *** * ** charcter:");
* * ***** * *** * ****** * * * *****
* * **** * ** * ** *
* * ** ** * * * * *** * *** = %c and its ASCII code is %d\n",ch,ch);
****** * ** * ** **** * * *** *
***** * * ** ****
* **** *** *** * **** 0;
}
answered by (212 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.77
©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
| 10.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
| 6.8k 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
| 1.5k 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
| 1.4k 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
| 6.9k views
12,783 questions
183,442 answers
172,219 comments
4,824 users