0 喜歡 0 不喜歡
13.3k 瀏覽

Write a program that reads strings of up to 1000 characters continuously and displays them, after replacing the lower letters with upper letters and vice versa.

寫一個程式 輸入一個字串(最多1000)  把小寫轉大寫大寫轉小寫

Example input:

With the rise in GLOBAL warming and increasing POLLUTION levels, it is becoming essential to find a viable alternative to the internal combustion engine petrol powered CAR.

Example output:

wITH THE RISE IN global WARMING AND INCREASING pollution LEVELS, IT IS BECOMING ESSENTIAL TO FIND A VIABLE ALTERNATIVE TO THE INTERNAL COMBUSTION ENGINE PETROL POWERED car.
[練習] Coding (C) - 最新提問 分類:Chapter 13: Strings |
ID: 41431 - 從幾時開始: 無限制 - 到幾時結束: 無限制

修改於 用戶: | 13.3k 瀏覽

57 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
* * *** * * ****** ** a[100];
** * ** * * * * **** ****** ********* * *
* *** * * * ** *** ** i;
**** ** * * * *** * * * * * *
* * ** *** * ** ***** * **
* * * * ** * * * *** ** * ** * * **** * * ** * * * ***** ** ** * * * **** **** * *
* **** *** * * **** * ******** * * *** * ** **** ** * * ** ** ** ***
*** * ******** * * ** ** * *** * * * * * ***** * * * ** ** * *
*** * ** * * * ** * ** * * **** ** * * * **** * ******* * ** **** * * ****

    }
*** ** ****** * *** * ******* * **** *******
* * ** * * * *** * * *** 0;
}
最新回答 用戶: (-140 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
* ***** * * * ****** ** a[100];
*** ** ** *** * * ** * ** ** * * **
* * ** * ** *** * ** i;
*** * * ** **** * * **** * ******* ** ****
* * ** ** * *****
* * * ** * * *** * ** * * * * ** **** * * *** ***** ** * * * * * * *** * **
******* * * *** ** *** ** **** **** * ** * ********* ** **** * ** * *
* * *** * * * * * *** * * * * * * ** *** ** * * *** * * * * *** * **
***** * ** * * *** **** * *** * * * * * ** * *** *** * * * * ** * *

    }
*** * **** ********* * * * **** * ***
*** * ** * *** **** **** 0;
}
最新回答 用戶: (-140 分)
0 0
prog.c: In function 'main':
prog.c:13:28: error: expected expression before '[' token
         else if(a[i]>='A'&&[i]<'Z')
                            ^
0 喜歡 0 不喜歡
內容已隱藏
#include *** ** *** *

int main ()
{
** *** *** ** ** c = 0;
* * * * * * * ch, s[1000];

** * * ******* * * ** *** * * ** a ** * *******
* * ** * **** **

* * ** **** **** (s[c] != '\0') {
* ****** * * ** * ** * ** * * * ** * = s[c];
* * ** ** *** ** * ****** * ** (ch >= 'A' * * * * ch <= 'Z')
*** * ** * **** ** * ****** ***** * ** * * * *** * ** * = s[c] + 32;
* * ** * * ** * **** ***** *** **** if (ch >= 'a' * *** * * ch <= 'z')
*** * * * * ** ** * ** ******* *** * * * = s[c] - 32;
* **** * * * ** * *****
* **** * **

*** ** ***** * ** * *** ***** **** *** s);

* * ** * **** **** 0;
}
最新回答 用戶: (16 分)
0 0
prog.c: In function 'main':
prog.c:9:4: 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/cckJajTZ.o: In function `main':
prog.c:(.text+0x3b): warning: the `gets' function is dangerous and should not be used.
0 喜歡 0 不喜歡
內容已隱藏
#include **** ** *
* * * * ** * ****
** * * ** **** *
int ** * **
{
char a[1000];
int i,n;

* * ***** * : * * * );
****** **** * * * *
*** *
* * *** * * ***
{
*** * * * * * *** **** ** ( ( a[i] >= 'a' ) ****** * ( a[i] ** 'z' ) )
**** ** *** * *** *** ** *** *** * * ** **
* *** ** * * ** * * * * * * ** ** *** * ** = a[i] - 'a' + 'A';
* ** *** * * * **** ** * *** * * *** ****
** ***** * ** * *** * ** * if( ( a[i] * 'A' ) * * * * ** ( a[i] *** 'Z' ) )
* * **** ** **** ** ** *** *** * * *** *
* * ** * * ** * ** *** * * * * * ***** = a[i] + 'a' - 'A';
* * * * * * ** * * * ** *** *** ** * ***** *
}

printf( ** * *** a );

*** ******* ** **
return 0;
}
最新回答 用戶: (-32 分)
修改於 用戶:
0 0
prog.c: In function 'main':
prog.c:10:1: warning: 'gets' is deprecated [-Wdeprecated-declarations]
 gets(a);
 ^~~~
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:11:3: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
 n=strlen(a);
   ^~~~~~
prog.c:11:3: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:11:3: note: include '<string.h>' or provide a declaration of 'strlen'
/tmp/ccbGRkOb.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
0 0
prog.c: In function 'main':
prog.c:11:3: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
 n=strlen(a);
   ^~~~~~
prog.c:11:3: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:11:3: note: include '<string.h>' or provide a declaration of 'strlen'
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include * * ** * *****

int main ()
{
** ** **** *** *** c = 0;
* * * * ** * * ch, s[1000];
* * ********* *** * * * * * s);

** * ** ** **** * (s[c] != '\0') {
* *** * * * ** * **** * * ** * = s[c];
** * * * ** * * * ** * (ch >= 'A' * ** ** ** ch <= 'Z')
* ** *** * *** * **** **** ** ** = s[c] + 32;
** ** * ** * ** **** ** * if (ch >= 'a' ** * **** ch * ** 'z')
* ** *** * *** ** * ** ** * * *** ** * * ** * = s[c] - 32;
* * * ****** **** * ** * * *** ** * **
** * ** *** * **

** ** ** ** * * ***** ****** s);

* * **** ** **** ** 0;
}
最新回答 用戶: (-140 分)
修改於 用戶:
0 0
prog.c: In function 'main':
prog.c:8:5: 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/ccEVmRzQ.o: In function `main':
prog.c:(.text+0x30): warning: the `gets' function is dangerous and should not be used.
0 0
prog.c: In function 'main':
prog.c:7:4: 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/ccYGFu22.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:12: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[1000]' [-Wformat=]
    scanf("%s", &s);
            ^
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

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

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

*** * *** * **** *** * i;
* *** * * ** ** ****** * ********** *** * ***** *
* * **** ******* ** *
** * ** * ** * * ** ****** ** * * ***** ** * * * ***** * ***
*** * * * * ****** * * * * * ** ** * * * * * * * **** * * * *


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


    }

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

* **** *** **** * 0;
}
最新回答 用戶: (-16 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
int main()
{
*** * ****** * * * * ** ** a[1000];
* ** **** * * **** ** * i=0;
** * ** * ** * *** ** ** ** * *
**** * ** * ** * * * (a[i]!=0)
    {
* ** * ***** ** ** * * * *** **** ******* * * (a[i]>64 && a[i]<91)
*** * * * * * *** ** * ****** ** * * **
* ***** ** * * * * * * *** * *** ** * * * ***** *** * *** ** * *
** * **** ******** * * * * * ***** *** *
* ** * * ** ** ****** * ******* * * *** *** * ** if (a[i]>96 && a[i]<123)
***** **** ** *********** * *** * * * * * *
** * ** ***** **** *** ***** *** ** *** * ** ** *** ** ** * * *
* * ***** * * *** ** ***** ** * ** * ** * *
* * ***** ** * * ******** ** * * **
    }
** ** * ** * *** * ** * ** ***
******* * ** ** * ** ***** ** 0;
}
最新回答 用戶: (-229 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include ** *** **
#include ********* * *

void main()
{
* **** ** * * * *** * * sentence[1000];
* *** * * **** * ** * count, ch, i;

* *** * * * * *** ** (i = 0;(sentence[i] = getchar()) != '\n'; i++)
*** ** ** ** * *** * * **
** * ********* *** * * * ** * * * ***
** *** ** ** * *
** ** ** * * **** * **** * = '\0';
* * ** ** *** *** *** = i;
* * * *** * * * ** ** (i = 0; i < count; i++)
** ** * * **** * *
* * * ** * * ** * ******* ** ** = * *** ** *** ** *** * * * :
* ** *** *
** * * ** * ** * * * * * ******** **** * ** ** * * **
*** ** * *** * **
}
最新回答 用戶: (-168 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
** * * * ** *
* *** *** ** ***
int ** *
{
* * * char a[1000];
** * * ** ** * * * ***
**** ** int i;
* ** ** * * * * * **** *
* * ** ** * {
*** * * *** ** ** * * ** * ** ** * * *** * * ** **
* * **     {
* ***         * ** *
*   * * * *** }
* ** ***** * *** * * else ** * ** * * ***** * * ****
** * * * ** * * * {
* ** * ** *** *** * * ** * * ** * * **
* ** * ** * ** }
** * * *** }
* *** * * ** ** * ** * *
}
最新回答 用戶: (-249 分)
修改於 用戶:
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
#include<string.h>
int main()
{
    int i;
    char a[1000];
    fgets(a,1000,stdin);
*** **** * * **** *** * ** * ** *
* ** ***** **** **** **** * * ** * * * **
***** *** * ** * *** *** ** * * **** **** * **** ** ** * * *** * ** && a[i]<='z')
** **** * ** * ** *** * * * * * *** * * *** * * * ** ** ** * ** * *** ** *** ** *
* *** ** ****** * * * * **** * ** ** * ** * **** * ** * * ** * ***** *** ** *** * * * *** *** * * **** * ** * * *
** *** * * * * * ** ****** **** * ** * * * ** * * * * * * *** ** ** ***
** *** ** ** **** * *** ** **** * ** * * ** **** * * * ** * if(a[i]>='A' && a[i]<='Z')
* * **** * * ** ** * * ** **** **** * ** * ***** * * ** * * * **** * *
*** ** ****** * *** * *** ** ** * * ** * * *** *** *** * ** * ***** *** ******** * *** ** *** * * * ** * * * *
** ***** ** ** ** * ** * ** * ** ***** * ** ** *** ***** * * ** ** ** * * * ** ** *** *
* * *** * * ***** *** * * * * * ** ** *
* * * ** *** * * * **** ** * * * * * **** ** **** * * *****
}
最新回答 用戶: (-258 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.216.251
©2016-2025

相關問題

0 喜歡 0 不喜歡
27 回答
[練習] Coding (C) - 最新提問 1月 11, 2018 分類:Chapter 13: Strings | 用戶: thopd (12.1k 分)
ID: 41439 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 9.1k 瀏覽
0 喜歡 0 不喜歡
29 回答
[練習] Coding (C) - 最新提問 1月 11, 2018 分類:Chapter 13: Strings | 用戶: thopd (12.1k 分)
ID: 41436 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 9k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶