2 like 0 dislike
5.8k 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.8k views

29 Answers

0 like 0 dislike
Hidden content!
#include * * * * **
int main ()
{
* * * ** char ch;
* * ** * **** *** * * * **
** * * * **** * ** * ** *
** ** **** *** ** **** ** * * *
* * * *
* ** * **** system **** ****** **
** **** * *** return 0;
}
answered by (215 points)
0 0
prog.c: In function 'main':
prog.c:9:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system ("pause");
  ^~~~~~
0 like 0 dislike
Hidden content!
***** ** * * ** * *
int ***
{
***** ** *** * * char ch;
* ** **
* * ** *** ** * *** * * * *** ** ***
** * * ** * *** ** * ** * ********
******* * ** *
* * * ** * ****** ** = %c and its ASCII code is **** ***
* ** *** ** *
* * * * ** * * *
* ** * * ** * * return 0;
}
answered by (212 points)
0 0
prog.c: In function 'main':
prog.c:11:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system("pause");
  ^~~~~~
0 like 0 dislike
Hidden content!
** * ** ** * *****

int * ** **
{
*** * *** * int ch;
** *   * * ** **** character: * * *** *
* * * * * ** ** ** * *** * ** **
* *** * *** * ** * **** ** *
** * *
*   * * * * ** ** * ****
** ** **** 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);
          ^
prog.c:10:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system("pause");
  ^~~~~~
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);
          ^
prog.c:10:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system("pause");
  ^~~~~~
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);
          ^
prog.c:10:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system("pause");
  ^~~~~~
0 like 0 dislike
Hidden content!
#include ** ** * * ** * *
int main()
{
*** *** * * int ch;
****** ** * * * * * * ** ** **
** ** * * * * * ** ** ** * *******
* * ***   *** ** *** * * **
* ** * * * * * ***** *
** * * * * return 0;
}
answered by (190 points)
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
prog.c:8:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system("pause");
  ^~~~~~
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
prog.c:8:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system("pause");
  ^~~~~~
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
prog.c:8:2: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
  system("pause");
  ^~~~~~
0 like 0 dislike
Hidden content!
#include * * ** ***
int main()
{
* ** ** *** int ch;
* * *** * *** *** ***** * * ** * **
* * *** * * * * * * *** ** **
** ** ***** * ** *** * ** **** **
* ** * * * return 0;
}
* *
answered by (196 points)
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
0 0
prog.c: In function 'main':
prog.c:6: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!
** * * **** * *****
* * ***** ** *
main()
{
char c[1000];
int i;
* * * ***** * * ** ** *
* * **** **** ** *** * *
* * ** *** * **** ** * * * ** * *






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


}
answered by (174 points)
0 0
prog.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
0 0
prog.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
0 0
prog.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^~~~
0 like 0 dislike
Hidden content!
#include ** *** * * *
int main()
{
**** * * * ** * * * ch;
** * **** * * ***** **** * * * * ***** *
** * *   * * *** *** * **** * * * ** *
****** ****** ** * * * ** ******
* *** **** *** return 0;
}
answered by (209 points)
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&ch);
          ^
0 0
prog.c: In function 'main':
prog.c:6: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!
#include<stdio.h>

int main()
{
** *** ** ** * a;
* * ** *** * * * * * **
**** * * ** * ** ***** * * ** * ** * *** * *
* * * * * * *** ***
*** * * * ** ***** * * * ** **
* ** * * ** ** ** * * *** ** ** *** ** * ****
}
answered by (192 points)
edited by
0 0
prog.c:2:18: fatal error: conio.h: No such file or directory
 #include<conio.h>
                  ^
compilation terminated.
0 0
prog.c:2:18: fatal error: conio.h: No such file or directory
 #include<conio.h>
                  ^
compilation terminated.
0 0
prog.c:2:18: fatal error: conio.h: No such file or directory
 #include<conio.h>
                  ^
compilation terminated.
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()
{
* * * * ** * * * * ** ch;
*** * * * * ***
** * * ***** ** *** * **** character:");
* ***** * ** ****** * * **** ** ** *** ** ***
*** * *** * **** ** * *** **
** * *** **** *** ** ** * ** ** and its ASCII code is %d\n",ch,ch);
* **** * **** * ***
* ** *** * ** * * * *** *** * * * * **
** * * ** * *** * 0 ;
**** * ***** * * * ** ** *
* *** * * ** * *
*** ** ** ** ***
answered by (194 points)
0 0
prog.c: In function 'main':
prog.c:11:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 0
prog.c: In function 'main':
prog.c:11:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
0 0
prog.c: In function 'main':
prog.c:11:5: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
     system("pause");
     ^~~~~~
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.163
©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
| 962 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
| 890 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