0 like 0 dislike
4.9k 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.9k views

12 Answers

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)
** ** *** ** * * *** * ** ** *** **** * * **
**** * * * *** ** * * * **** * * ** * * ** *** * ** * ***
* * * * ** * *** * * ** * ** ** ***** * *** *
*** ***** ** * ** * * ** * ** **** ** *****
    }
******* * * ****** *** * * * * ***
* *** * ** * * * * 0;
answered by (-229 points)
0 0
prog.c: In function 'main':
prog.c:20:5: error: expected declaration or statement at end of input
     return 0;
     ^~~~~~
0 like 0 dislike
Hidden content!
#include * ** **** ***
#include ** ** *

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

** * ***** ** ** * * * * *** *
* * * * **** *** * * ** *** = strlen(str)-1;

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

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

** **** *** ** 0;
******
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/ccBoKIfO.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:104.23.243.109
©2016-2026

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.7k 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.6k 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
| 3k 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
| 3k 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
| 11.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users