2 thích 0 k thích
9.4k đã xem
請寫一個程式將輸入的小寫字母都轉成大寫字母

輸入說明:

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

輸出說明:

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

輸入範例;

1234567890ABCDEFGHIJKlmnopqrstuvwxyz*

輸出範例:

LMNOPQRSTUVWXYZ
[Exercise] Coding (C) - đã hỏi trong 2017-1 程式設計(一)AD bởi (18k điểm)
ID: 31088 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 9.4k đã xem

31 Trả lời

0 thích 0 k thích
Hidden content!
#include * * * **** *
#include * * **** ***
#include * * ** *

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

*** * * * * * }
* * **** * * ** return 0;
}
trả lời bởi (114 điểm)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
0 thích 0 k thích
Hidden content!
* * * * **** *
** * * * *** **
int main()
{
* * * ** * * char arr[100];
* * * * * **** ** ***** **** *** * * *** **
** * * ** {
* * * ****** ** *** ***** int * * **
* *** ** **** *     * * * *** **
** * ** **     {
* * *** *** ** ** **** * *** * * * * ** * * * ** ****
* * **** * ** * * * * ** * ** **** ** * * * *** * *
* * *** ** ** * * ** * }
***   }
**** **** ** return 0;
}
trả lời bởi (100 điểm)
0 0
Case 0: Correct output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
   int i,j=0;
* ** * ** * *** *** a[1000],s[1000];
* ** *** *** ** *

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

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

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

 return 0;
}
trả lời bởi (172 điểm)
đã sửa bởi
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 thích 0 k thích
Hidden content!
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(){
* * * *** * * * *** ** s1[1000];
** ** * * * * * ***** ** i=0;

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

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

* * * * ** * **** ** ** * ** 0;
}
trả lời bởi (212 điểm)
0 0
prog.c:2:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
0 thích 0 k thích
Hidden content!
#include <stdio.h>
#include <string.h>
int main(){
**** ** **** ***** *** * s1[1000];
* * * ** * *** * * i=0;

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

* * ***** ** *** ** ** 0;
}
trả lời bởi (194 điểm)
đã sửa bởi
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
   char ch;
* ** *** * **** * ** ** ** * * ** ***** ** * ** *
* *** ** * *** * *** ******** ** ** * * ** * *** *
**** ** * ** ** * **** ** * * * * *
* *** * * ** **** * * *****

** * ** ** * ***** * ** * ** * *
* * ** * ** * ** *
   {
* * * ** ** *** ** * ** * * ** * * *** ** * * * * * **** * **
** * * * **** * * * * * * *** * * * * ********* **
*** ** * *** ** ***** ** * * ** * * ** * * ** ******
*** ** * * * ** * ** ** *** * ******
* * **** * *** ** ** * ** * * * ** * ** *** * **** * *
   }
   
   return 0 ;
}
trả lời bởi (194 điểm)
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 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
 int i,j=0;
 char a[1000],s[1000];
** * ** * * ** * *** * *

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

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

  }






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

 return 0;
}
trả lời bởi (236 điểm)
đã sửa bởi
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 thích 0 k thích
Hidden content!
*** * ** * * *** **
int main()
{
** *** *** * *** i;
**** *   char str[5000];
** ** * ** * * **
** * ** * * * * ** * *** str);
* *  
* ** * *** * * * * (i=0; * **** i++)
*** * ******** *** * * * ***
*** * * * ** * ** ** *** * * * * * ***** * * * * *** *
* *** * * * * * *   {
* * *     ***     break;
* **       }
* * ** *     ** else ** **** ** * * * *** * ** ****
** * ** ** *** ** * *** * * * * *** * * {
* ***** * * *** ** * * *** * ** ** * ** * ** *** ** * *** *
* *** * ** * *** ****** * ** * * *** ** *** ** * ** * * * ** * ** * * *** *** **
** ** ** * *** ** ** * }
*** *** * ***** ** ** else
* ***** **** **** ** {

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

*** ** * * * *** 0;
}
trả lời bởi (202 điểm)
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 thích 0 k thích
Hidden content!
#include ***** * * *

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

** * ** * ;
***** = *** ** *
** * ** (*ptr != '*')
* *
* * * ** ** **** ** *** * *** * *
**** * * ** * ** * * ** * **** * *(ptr++) - 32);
* ** **** ** ** if ** ** ** * * * ** * * *
* * * ** ** * * * ********* **
* * ** ****
** *** * *** *** * **
** ** *
*** * * ** * ** ** ** *
* ******* 0;
}
trả lời bởi (228 điểm)
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 thích 0 k thích
Hidden content!
******** **** *** * ***
* * ** ** ** ** *

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

** ** * *
* * *
{
***** * ** ** ** ** ***** * * ****
****** ** * * ** * ****
else
** **** * * ***
}
}
trả lời bởi (228 điểm)
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.130.70
©2016-2025

Những câu hỏi liên quan

2 thích 0 k thích
29 trả lời
[Exercise] Coding (C) - đã hỏi ngày 9 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi Shun-Po (18k điểm)
ID: 31094 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 8.6k đã xem
2 thích 0 k thích
23 trả lời
[Exercise] Coding (C) - đã hỏi ngày 9 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi Shun-Po (18k điểm)
ID: 31085 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 6.2k đã xem
3 thích 0 k thích
9 trả lời
[Exercise] True/False - đã hỏi ngày 16 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 33764 - Xem được từ: 2017-11-16 14:00 - Hiệu lực đến: 2017-11-16 14:30
| 1.4k đã xem
3 thích 0 k thích
9 trả lời
[Exercise] True/False - đã hỏi ngày 16 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 33763 - Xem được từ: 2017-11-16 14:00 - Hiệu lực đến: 2017-11-16 14:30
| 1.3k đã xem
3 thích 0 k thích
6 trả lời
[Exercise] Coding (C) - đã hỏi ngày 30 tháng 11 năm 2017 trong 2017-1 程式設計(一)AD bởi Shun-Po (18k điểm)
ID: 34979 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 2.4k đã xem
12,783 câu hỏi
183,442 trả lời
172,219 bình luận
4,824 thành viên