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

輸入說明:

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

輸出說明:

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

輸入範例;

1234567890ABCDEFGHIJKlmnopqrstuvwxyz*

輸出範例:

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

31 Answers

0 like 0 dislike
Hidden content!
#include * **** ** **
#include * * ** *** ** *
#include * * * **

int main(int argc, char const *argv[])
{
*** ** ** char * **
* ** * * int len,i;
* * ** ** ** * ** * ** * **
** * * {
** *** *** **** **** *** * *****
* ** *   ** ** * * *** *
*** * * ** * * ** *** * ** * ** ***
** * ** * ** * ***** * {
* * ** * ** * * * **** * ** * ** * * * * * * *** ***** * * ** ****
* *** ** ***   * * * ** ***** * * * *** * ** * ***** * * * * ********
** *** * ** ** * * * * * }

** * *** }
***** ** *** return 0;
}
answered by (114 points)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
0 like 0 dislike
Hidden content!
* ** * * * * * ** *
***** * * * **
int main()
{
**** ** * char arr[100];
*** **** *** ** ** * * ****
** * * * {
** * *** ** * ** int * *
* * ** * ****     ** * * *** ***
* * * ** ** *     {
***** * *** * * *** * *** * * * * ** * ** ***** ****** * * * * ****** * **** *
******* ** * * * * ** * ** ** * * * * ** ** * **** ** ** * * *
*** ** * * * ** * }
* **   }
* * *** return 0;
}
answered by (100 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
   int i,j=0;
** * * * * * ** a[1000],s[1000];
*** * *** * * ************* * * **

** * ** * * *** ** * **** ** *
   {
* ** * ** **** * ***** * * ** *** * ** * ** ** * * **

* *** *** ****** *
**** *** ** *** * ** * * * * ** ** ***** * * ** ** * **
**** * * * **** ***** ** ** * ** ** ** * * *** ** ** * * * * *
** ** * ** * * * *
* * * *** ** * ******** *** * **** **** *
***** ** ** *** ** ** ** * * ******* * *** * ** ** * * * * ** ** **
  }

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

 return 0;
}
answered by (172 points)
edited by
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(){
*** * *** ** *** *** * s1[1000];
*** ** ** ** **** ** i=0;

* ** * ****** * * * ** * s1 string

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

** * ** * ** * * ** ** 0;
}
answered by (212 points)
0 0
prog.c:2:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main(){
** * * * *** ** ** ** *** s1[1000];
**** *** * **** * * ** * * i=0;

* * * * ** * ** *** * * * * *
* ** * *** **** ****
   int k=strlen(s1);
* * ** * ***** **** ***
**** * ** ** * * * * ** * 0 ;
*** * * * **** * ****** ***** * **
***** * * * *** * * *** *** **** * **** * * * * ** *** * * ***
*** **** * * ** * ****** ** * * * ** * *** * * * * * * *** * ** ** * * * **
*** * *** * *** * ** * * * ** * **
** ** * * *****

** * ** * ** *** ** *** * 0;
}
answered by (194 points)
edited by
0 0
prog.c:2:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
0 0
prog.c: In function 'main':
prog.c:7:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(s1);
     ^~~~
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/ccb3kRGx.o: In function `main':
prog.c:(.text+0x2f): warning: the `gets' function is dangerous and should not be used.
0 0
prog.c: In function 'main':
prog.c:7:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets("%s",s1);
     ^~~~
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__;
              ^~~~
prog.c:7:5: error: too many arguments to function 'gets'
     gets("%s",s1);
     ^~~~
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__;
              ^~~~
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
   char ch;
*** * * * * *** * * ** ** *** ** ** * ****** **
* ** * ** * * * * ** * * ** ** *** *** * * **
* ****** * *** * ** *** * * ** ********** ** *
* **** ** ** * * ***

*** * * * * * ** * * * * ** * **
** ** * * * * ** * * *
   {
* **** ** * ** * ** ** * * * ** * * ** * * * * * * *** * ***
** * ****** *** * * * ** *** * ** * **
* * * ** *** **** * * ** **** **** * * ******* ** * * * ***** **
***** * * ** * ** ** * * * * **** *
* * ** **** * * * **** **** ** ** ** * * * * * ** * ** ** *
   }
   
   return 0 ;
}
answered by (194 points)
0 0
prog.c: In function 'main':
prog.c:10:4: error: expected ';' before 'printf'
    printf("%d\n",ch);
    ^~~~~~
prog.c:11:7: warning: implicit declaration of function 'isalunm' [-Wimplicit-function-declaration]
    if(isalunm(ch))
       ^~~~~~~
prog.c:13:8: warning: implicit declaration of function 'print' [-Wimplicit-function-declaration]
        print("%ch\xe5\xad\x97\xe4\xb8\xb2\xe7\x82\xba\xe5\xad\x97\xe6\xaf\x8d\n",ch);
        ^~~~~
prog.c:14:11: warning: implicit declaration of function 'islower' [-Wimplicit-function-declaration]
        if(islower(ch))
           ^~~~~~~
prog.c:15:46: warning: implicit declaration of function 'toupper' [-Wimplicit-function-declaration]
         printf("\xe5\xb0\x87\xe5\xad\x97\xe6\xaf\x8d\xe8\xbd\x89\xe6\x88\x90\xe5\xa4\xa7\xe5\xaf\xab:%ch\n",toupper(ch));
                                              ^~~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
 int i,j=0;
 char a[1000],s[1000];
** * ** * * * * *

*** ***** ** * **
  {
** * * *** **** **** * ** ** ** * * * * * * ** ** * *** * * ** ** **

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

  }






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

 return 0;
}
answered by (236 points)
edited by
0 0
prog.c: In function 'main':
prog.c:36:1: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
 system("pause");
 ^~~~~~
0 1
Case 0: Correct output
0 0
prog.c: In function 'main':
prog.c:29:3: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
   system("pause");
   ^~~~~~
0 0
Case 0: Correct output
0 0
Case 0: Correct output
0 0
Case 0: Correct output
0 0
Case 0: Correct output
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
**** ***** *** **
int main()
{
** * ** ** * * *** ** * * * i;
* * ** *   char str[5000];
*** **** ** * ** ****
* * * * ** **** ** ** str);
* *** *  
* * ** * ** * * * (i=0; **** ******* i++)
**** ** * ** ** ** * * ** *
* *** * ** ** ** * ** * * ********* ** * ** **
*** * * ** * **   {
** ** *     *     break;
** ****       }
*     * else ** * * ** *** * ** ** * * ***
* ** ** *** ** *** ******** ** * * ** {
*** * ** * * *** *** * ** * * * * **** * ** * ** * *
****** *** * ** *** ** * ** * * * ** * * * ** ** *** ** * ** *** * ***
** ** ** * *** *** * * *** }
**** * ** ** ** * ** else
** * * **** ** * * * {

* *** * **** * ** * * * }
* ** * * * * * ****** *
** * ** * * * * ** * * * ***

* ** * * **** *** *** * * * 0;
}
answered by (202 points)
0 0
prog.c: In function 'main':
prog.c:22:11: warning: zero-length gnu_printf format string [-Wformat-zero-length]
    printf("",str[i]);
           ^~
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include ** ******** *

int main()
{
** ** * * str[100];
*** ** *ptr;
** u = 0, l = 0;

* * *** * ;
** * = * * ** *
** ** (*ptr != '*')
* ***
** ** * * * * * * * *** * ** * *
* ** ** ** *** ** * ***** * * *(ptr++) - 32);
** * * * * if * * * ** * *** ** * **
* ** *** *** * ** * * ** ***** ** **
** ** ** ***
*** *** * * * *
*** *
** *** ** **** * *****
*** * * 0;
}
answered by (228 points)
0 0
prog.c: In function 'main':
prog.c:9: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/ccrUo9sb.o: In function `main':
prog.c:(.text+0x2d): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
* ** * * * * * *
* * * * *

int * * **
{
char * ** *
char *ptr; * *
* * *

* * *
* ** * **
{
*** ** * * ** * * *
**** ****** ** *** * * **
else
* * *** * ***** * * *
}
}
answered by (228 points)
0 0
prog.c: In function 'main':
prog.c:8: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/cc3WJuEP.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.214.236
©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
| 7.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.9k 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.1k 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.1k 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
| 1.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users