0 like 0 dislike
4.4k views

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.
[Exam] asked in Final Exam
ID: 43459 - Available when: 2018-01-20 09:00 - Due to: Unlimited
| 4.4k views

12 Answers

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

int main(){
** * *** ** * * * str[1000];
*** * *** * ** ** * ** ** len,i;

**** *** ** * * * *** *** *
** * *** *** *** *** * ** * * = strlen(str);

* ** **** ** * * * *** * * * **** *
* * **** * ** ** *** **** ** ** * * ** >= 'a' && str[i] <= 'z')
* **** * * ** * * *** * * * * * * ***** ** * * * * * * = str[i]-32;
* * ** ** *** ** ** ** * **** *** * ** * * * if(str[i] >= 'A' ** *** * str[i] <= 'Z')
** ** * * * ** *** * ** *** * * * * * * * * * *** * ** * * * * = str[i]+32;
* ** ***** * *****

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

** *** ********** 0;
*** * *** * *
answered by (-74 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include ** *** **
#include * * *** * **

int main(){
** * ** * ** ** ** *** str[1000];
* * ** *** ** * ** **** len,i;

**** ***** ** ** * * *
* * * ** * ** * = strlen(str);

* *** * * * * * * ** ***** ** * *** *
****** *** *** ** **** * * ****** *** * * * * * * >= 'a' && str[i] <= 'z')
**** * ** ** ******* * ******* ** ****** ** *** *** * **** * * * ** ** *** * = str[i]-32;
* * *** *** *** * * * * * * ** ** ** * ** if(str[i] >= 'A' * ** ** * str[i] <= 'Z')
***** * * *** ***** * * * *** ** * ** * * ****** * **** * ** * = str[i]+32;
*** ** * * ****** *

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

***** * *** *** 0;
*** ** ** * **
30/100 answered by (-74 points)
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/ccUxtyAl.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!
#include <stdio.h>
#include <string.h>
int main()
{
* * *** **** * ** * * i=0,j=0,l;
** ** * *** * * **** * a[1000];
*** **** * ** * * ** * * * * *
* ** * ** * * * ** ** ** *
* ** * ** * * *** ** **** *** (a[i]!=0)
    {
* **** * * * ** * *** * ** *** * * (a[i]=='\n')
** *** **** ** * * * * ** ** * *** **
** * * ** * * * ** * * * * ** * ** * * ** *** * ** * * **
* * * *** ** *** ** ** * * * * *** * **** *
* ** ** * ** **** * *** * * * * * * ** *** (a[i]>64 && a[i]<=91)
** * ** * **** * ****** ** *** * ** * *** **
*** *** ** *** * ** **** **** ** ***** ** * * ********** ** * *
* *** * * * * *** ** *** ** *** *** *
** **** * * * * * ** ** * ** ** * * * if (a[i]>96 && a[i]<123)
* ** *** *** ** * * * * * * * ** ** * ***
* * * * ****** *** *** ** ** **** * * ** *** *** * ** * ** **** ** *
*** * ***** ** ** *** **** ** * ******
* * * **** * ** ****** *** * ** * *
    }
* * ** * *** *** *** * * ** *****
}
answered by (-229 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main()
{
*** *** * * * ** * ** i=0,j=0,l;
* * ** ********** ** ** a[1000];
* *** * * * *** *** **** * ******* ***
** * ** * *** * * * **** * *
** * ** **** *** (a[i]!=0)
    {
* * * * ***** * ****** ***** * ** **** (a[i]>64 && a[i]<=91)
******* *** * * ** * ***** * *** ** ***
** * * *** * *** * *** ** * *** * * * * ** * * ** * * ****** *** *
* * *** ** **** ** * * * * ** ****** *** **
* * ****** * *** ** *** *** ** * ** if (a[i]>96 && a[i]<123)
** * * * ** * ** ** ***** * ** ** ******
* ***** * * * ***** ** * ** * ** * *** *** ** * ** * ** *** ** * **
** * * *** *** * ** * * * * *
**** * * *** * * * ******* * * **
** ** *** * * * * *

** * * * * * ** ****** (l=0;l<j-1;l++)
** * *** **** * * ** **
** * ** *** ** * ** * ** * * * **** * ****** ** * *
* ** *** *** * *** *** *
}
answered by (-229 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char A[2000];

int i;

int main()
{
**** * * ***** ** **** * * ** *

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

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

* * ***** * * * * * * **** * * * **** && A[i]<=90){
** ** *** *** ******** ** **** ** * ** *** * *** * *** * * ** * * * *
** ***** ** ** ** * * **** * * ******** **** * * * * ***
*** * ** ** ** ** * * * ******* * * * * * ** * ** ****** * **** tag;
* * ** * ** *** *** * **** ** *

** * ***** * ** ** * ** ***** ** ** * * ***** * * && A[i]<=122){A[i]-=32;}

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

* ****** * ** * * * ** 0;
}
answered by (-286 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main()
{
*** ** *** ** * * * * ** i=0,j=0,l;
* * *** * * * * * **** a[1000];
* * ******* * **** * ** ***
* * **** * * * ** **** *****
* ** * * * ** **** * ** * (a[i]!='\0')
*** ** * * * *
* * * * ** ** *** ***** * * * * * * * *** (a[i]>64 && a[i]<=91)
** * ******** ** ** * ****** * * * ***** **** *
* ***** *** **** * * * *** * *** * **** * ** * * ** ** *
*** * * ** ** ** * * *** * * * * ** * **
* * *** * ***** ** *** ** * * * ***** **** * * if (a[i]>96 && a[i]<123)
* ** * ** *** ** * * * ** ****** * * ***** * * * * *
**** * * * **** * * **** *** * * ** ** *** **** * *
* * ** * ** * ** **** * * ** ** **** ****
* *** * * * ** * * *** * *** * ** *
**** ****** * * ** *** * *

** ** * ** * * * * (l=0;l<j;l++)
    {
** ** * * *** * ***** * *** * *** * *** **** *** *
** * *** * * * * *
*** **** * ** **** ** 0;

}
answered by (-229 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main()
{
* * * * ** * **** * ** *** i=0,j=0,l;
* * ** * * ** ** ***** a[1000];
* * **** * * * *** * * ** * *
*** * ** ****** ** ** ******
* ** ** ** * **** (a[i]!='\0')
** **** * * **** * * * *
* *** * * ***** * * ** * ** * *** * ** * **** (a[i]>='A' && a[i]<='Z')
* * **** ** * * * * * *** * ** * *** *
* * * * ** * * ** *** * * ** ** * * * *** * * * ** * ** * *
* **** *** ***** * * ** * * * *
*** **** * * *** ** *** * *** * **** ** * ** ** * if (a[i]>='a' && a[i]<='z')
* ****** * *** ** ** **** ** ****** ******* * *
* ** * ******* * * * * * *** ** ** ** *** ** *** ** ********* * ** ** * *
**** * * * ** ** ******* * * ** * * * ***** * *
*** * * * *** ** ** * *** * * ** ** *** * *** * ****
* ** * ** * ** *

* *** ** ** * * (l=0;l<j;l++)
    {
* ** ****** ** * *** * ** **** ** ** * ** ** * *** * * ***** *
* * * **** ** **** *****
**** ** * ***** * * * * * *** 0;

}
answered by (-229 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main()
{
* *** **** ***** * * ** i=0,j=0,l;
**** *** ** * * * * *** a[1000];
*** * * * * **** * *** * ** * *
* * * * * **** * * ***** * *
** ** *********** *** ** ** * * (a[i]!='\0')
* ** * * ***** * * ****
* ****** ** * * *** ** *** ****** * * * * * (a[i]>'A' && a[i]<'Z')
* *** * * **** * *** * *** * * * * ** ** *
* ** ** ** * * ** * * **** * * * *** *** * ** * ** ** ** **
*** ** *** * * * * * ** **** * ** * ** *
* * **** * *** * * * * * *** *** * * if (a[i]>'a' && a[i]<'z')
**** ****** ** * *** * ***** * ** *
* * * * * *** ***** * ** * *** *** * * **** * *
* * ** **** ** * * ** * ** * *** ****** ***
** **** ** * *** ***** ** * * * * **** ** * ** * *
** **** ** * * *** ** * *

** ** * **** * * *** (l=0;l<j;l++)
    {
* *** * * **** * * * * * ** * **** ** * * * * *** * **
** * * * * * ** * *
*** *** ******** *** * * ** 0;

}
answered by (-229 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main()
{
*** * *** * *** * *** *** str[1000];
** * * * * * ** length;
* * * ** * * *** * ** *** i;


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

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


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

* * * ** * * **** * * * ** * **** ***** * ** ** *** * && str[i]<='z')
** ** * ** **** **** * *** ** * * ** * *
* ** * * *** * *** ** ** * ** ** *** **** * **** ***** ****
* * ** ** ***** * ** * * *** ** * *

* ** ****** * *** ** * *** * ** * **** ***** * ** if(str[i]>='A' && str[i]<='Z')
* **** *** ******* ** ***** * * * *** ** *** * * ****
* ****** ** ** * * * **** *** * * * * * * ****** * *** ** ***** * * *
* * ** * ** ** * ** * ** * ** ** * *
* * * * ** * **

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

* * * * ** * * **** ** 0;
}
answered by (-193 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
* *** ****** *** ** i=0;
****** * ** * * * ** * a[1000];
*** * ******* * * ** * * * * * **
** ** * * **** *** *** (a[i]!=0)
    {
* *** * *** ** * ***** *** * * ** * * ** *** * (a[i]>64 && a[i]<91)
** *** * * *** * ** * ** ** ***** * * *
*** ***** * ***** * * *** * **** * * ** ** **** * * ** * ** * ** * ****
** * * *** *** *** ** * *** ** **** * * * **
* * * *** ***** *********** * *** * * * * * * if (a[i]>96 && a[i]<123)
* * *** * * * *** ****** **** ** * ** ** *******
**** * ** * * * * ** * *** * * * **** * * ***** * * * *** ** * ***
*** ** ** ** ***** * * * **** *
* *** **** ** * ** * ** **** ** * ** * *
    }
** **** * * **** * *** * * * **** *
answered by (-229 points)
0 0
prog.c: In function 'main':
prog.c:19:5: error: expected declaration or statement at end of input
     printf("%s",a);
     ^~~~~~
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.214.204
©2016-2025

Related questions

0 like 0 dislike
13 answers
[Exam] asked Jan 19, 2018 in Final Exam
ID: 43463 - Available when: 2018-01-20 09:00 - Due to: Unlimited
| 4.3k views
0 like 0 dislike
6 answers
[Exam] asked Jan 19, 2018 in Final Exam
ID: 43462 - Available when: 2018-01-20 09:00 - Due to: Unlimited
| 2.3k views
0 like 0 dislike
8 answers
[Exam] asked Jan 19, 2018 in Final Exam
ID: 43461 - Available when: 2018-01-20 09:00 - Due to: Unlimited
| 2.7k views
0 like 0 dislike
4 answers
[Exam] asked Jan 19, 2018 in Final Exam
ID: 43460 - Available when: 2018-01-20 09:00 - Due to: Unlimited
| 2.7k views
2 like 0 dislike
30 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42298 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 10.4k views
12,783 questions
183,442 answers
172,219 comments
4,824 users