2 like 0 dislike
10.2k views
請寫一個程式將輸入的小寫字母都轉成大寫字母

輸入說明:

會輸入一連串的字元,最後會用一個*作為結束

輸出說明:

請將輸入的所有小寫字元都轉成大寫字元輸出,如果不是小寫字元就不做任何輸出。

輸入範例;

1234567890ABCDEFGHIJKlmnopqrstuvwxyz*

輸出範例:

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

31 Answers

0 like 0 dislike
Hidden content!
** ** * ***** *** *
** * * *** ** * ***
int main(void)
{
***   char * ** **
***   int i;
**   gets(s);
*** *   ptr = *** **
** * * * * * ** * ** != '*')
* **** * * * ** * **
*** * * * * * *** * **   * * * ** * ** * *** *
* * ** **** * * ** *** * ****** * * *** ** * * * *** *
* * * * * * * * * * * * *** else
* ** *** *** * * * * * **** * * * *** ** * *** ** **
*** *** ** }

* ** * return 0;
* ** ****
** **** * * **
* * *
answered by (228 points)
0 0
prog.c: In function 'main':
prog.c:7:2: warning: 'gets' is deprecated [-Wdeprecated-declarations]
  gets(s);
  ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/cclnjrco.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
* ***** * * *
int main()
{
* ** * ** *** char * * *
* * ** * ** *
* *   ** *
* * ** * ** ptr = ** ** * *
* ** * ** * *** != '*')
*** * *** * ** * *** * *** ** ** ** ****
** *   {
** ** * * ***   **** * * *** * ***** * * * * **
* * ** else * * ** *** * * **** *
** * * * {
** * ** * *** *** *** ** *** *** *** * ***
* *** * **** }
* * * *** ;
* ** * * *
* ** return 0;
}
answered by (228 points)
0 0
prog.c: In function 'main':
prog.c:6:2: warning: 'gets' is deprecated [-Wdeprecated-declarations]
  gets(str);
  ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/cc8wCv3L.o: In function `main':
prog.c:(.text+0x1f): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
* ******* ** *
int main()
{
* **** * * * * * char ** * * **
* * * * *** int i=0;
**** **** * ** * ** *
* *** * * * ptr = *** *
******* *** ** * **** != '*')
* * **** * * * ** * * ***** * *** *** ***
****   {
***** ** ** * *** * * ** ** ****** ** * *
*** * *** else ** * ** * * ** * **
* ***** {
* ** * ** *** * *** ** *** * ** ** ** *
* ****   }
** * *** ;
* * * ***
****   return 0;
}
answered by (228 points)
0 0
prog.c: In function 'main':
prog.c:6:2: warning: 'gets' is deprecated [-Wdeprecated-declarations]
  gets(str);
  ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccoAM7Ff.o: In function `main':
prog.c:(.text+0x26): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
* ** *** * *

int * * * **
{
* * * * int ch;
** *** ** ** * * ** ** ** ** ** ** *
** ***** ** ** ch = ***
******* ** *** while( ch != '*')
** ***** {
** * * * **** * ** *** ** if(ch * ** 122 * ******* ch >= 97)
** * * * * ** * * * * * ** * * * *
**** * * ** * ** *
** ** * ** ** * * * * * * *
** * * ** ** }
** ** * **
** ** * *
* ** *** * return 0;
* * * ** *
answered by (160 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<ctype.h>
int main()
{
** ** * * * * *** c;
* * * * * * * *** * * ***
**** *** * *** ****** * ** *** ***
    {
* ** * **** * * ****** **** **** ** ** *
* * ** *** * ** **** * * * * **** ** * * *
* ** * ** * * * ** ******** * **** * * ** ** *** **** * *** ***** * * * * * * * ** ** * *** **
********* ** **** ** **** ** ****** *** * ** * ***** ** * *** * *** * * *
* * ** * * * *** *** *** ** ** ** * ******* * *
* * ********** ** * *** * * ** ** **** * *** *
    }
* * ** * *** * * ** *** ** 0;
}
answered by (100 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<ctype.h>
int main()
{
    char c;
*** * **** * *** *** * * * * ***
* * ******* * * * * * * * * * * *** **
    {
** ** ***** * * * ** * **** ** ** * *** *** * **
**** * ** * *** ** ***** ** *** * ***** ** * * * **
* * * * * *** * ** ** * *** * **** ****** * ** * * ** **** * ****** * ** * * * ** * ** * ** **
* ***** * ** * ** * * * **** ** ***** *** * ***** **** * ** ****** **** *
*** ** * ** *** ** ** * * ** *** * ** * * **
* ** ** * * ** ** * * ** * * ********* ***
* * ** * ** * ** ** ** * * ****** * * *** ** * * * * * **** * * ** **
    }
**** ** * **** ** *** 0;
}
answered by (100 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<ctype.h>
int main()
{
** * * * ***** ** * c;
** ** * **** ** ***
*** ***** ** * ** ****** * ** ** ****** *** ** ***
    {
* * ** * * *** ** * * ****** *** ** ****** * * ***
**** ** * * * ** **** ** * * * **** ** * *** ****
* ** ****** * * ****** ** * * * ***** ** * * *** ** *** ***** **** * * * * ** ** **** *** * * * ***
* * ** ** * ** * * ** ** ** **** ** * * * * **** * * **** ** * **
*** ** *** * * ** * ** * * * * ** ** * **
******** * * * ** * *** * * *** *** *** * ** * **
    }
* ***** * ** *** ****** ** 0;
}
answered by (100 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<ctype.h>
int main()
{
** * * **** ** ** * * c;
****** * ** * ** * ** ** *** ** * *
*** * * *** ** * ** * ** *
    {
** ** ** *** * * ***** *** *** * ** ***** * * ** * *
**** * ** * ** * * * ** * *** * * *** * * *
** * ** * * *** ** * * * * * * * *** * * * * *** * ** *** * *** * * ** * * * * *
**** ** ***** ** * ** *** ** *** ****** ***** ** *** * * ** * **** **
** ** ***** * * * ***** * * * ********* * * *** **
*** *** *** ** *** ***** *** * * **** **
    }
*** * *** ** * ** ** * 0;
}
answered by (100 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    char c;
*** * *** * * * * ** * *
* ** * **** *** ** ** ** ** *
    {
* * * * *** * * ** **** * * * * ** * ** ****** ** *
* * ** ** ** * ** ** ** * * ** ** ***
** * * ** * * * *** * ** * ** **** * * **** ****** *** ** * * ** ** ** * **** ** * *
* * * ** * * ** * *** * * **** * * ** * * * * ** *** ** * * * * *
* *** ** * **** *** * * ** * * * *
* * ***** * ** *** * * ** * ** *** * * * **** ** **
    }
** *** ** * ** *** ** ***** *** 0;
}
answered by (100 points)
0 0
prog.c: In function 'main':
prog.c:8:15: warning: implicit declaration of function 'islower' [-Wimplicit-function-declaration]
         while(islower(c))
               ^~~~~~~
prog.c:10:25: warning: implicit declaration of function 'toupper' [-Wimplicit-function-declaration]
             printf("%c",toupper(c));
                         ^~~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    char c;
** ** * ***** * ** *** * ** * *
*** *** * * ** *** ****** * **
    {
* * **** * ** * **** ***** * * * **** *
* ** ** **** * *** * * ** *** *
** * ** * * * * ***** ** **** ** * *** *** ** * * *** ** *** * * ** * ** * ** ** * ******
* * * * * * * ** * * * ** * **** ** * * * * * *** * ***** * * ** * *
* ** * * *** * ** * * *** ** * * * ** *
** ** ** * * * * ** * * * * * *
    }
*** * **** *** **** **** ** ** * * * * ***
** * * *** ** * *** *** 0;
}
answered by (100 points)
0 0
prog.c: In function 'main':
prog.c:8:15: warning: implicit declaration of function 'islower' [-Wimplicit-function-declaration]
         while(islower(c))
               ^~~~~~~
prog.c:10:25: warning: implicit declaration of function 'toupper' [-Wimplicit-function-declaration]
             printf("%c",toupper(c));
                         ^~~~~~~
prog.c:15: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.214.205
©2016-2025

Related questions

2 like 0 dislike
29 answers
[Exercise] Coding (C) - asked Nov 9, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 31094 - Available when: Unlimited - Due to: Unlimited
| 9.3k 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
3 like 0 dislike
6 answers
[Exercise] Coding (C) - asked Nov 30, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 34979 - Available when: Unlimited - Due to: Unlimited
| 2.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users