0 like 0 dislike
10.1k 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.
[Exercise] Coding (C) - asked in Chapter 13: Strings
ID: 41431 - Available when: Unlimited - Due to: Unlimited

edited by | 10.1k views

57 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
int main ()
{
** * * ****** * * a[999];
* * * ** *** **** ***** i;
* ****** * * ** ** *** * *** ** (a,999,stdin);
* * ** ** ** * * * * * (i=0;a[i]!='\0';i++)
    {
*** * * ** * ** ** * * * *** ** * * * * * * * * ** ***** * **
* * *** * * * * **** *** * * ** *** **** * * ** ***** ** * * ** * *
* * * *** ** ** * * *** *** ** *** if * ** **** ** * * *** ** *** **
* * * * * * **** * *** * ** * * * * ** ** * * * ** * *** ** ***** ****
* *** * *** * * * ***** * * * * * * * * * * * *** *** ** *** * *** ** ** **** ** * ******
    }
* * **** * * * * * ** 0;
}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include * *** * **
#include <ctype.h>
#include * ** **

int main()
{
* ** * * ** ***** *** ** * str[1000];
*** ** ***** * * i;
** * ***** * * * ** ** * * ** *** **** * *
** * **** ** * *** *** **** * ***** *
**** * **** *** * ****
**** *** * *** * * ***** *** *** * **** *** (str[i]>='A' && str[i]<='Z')
* ** ** * *** * ** ** * ** * *** ** * * ** ** * * *** * **** ** * *** * **** *
**** *** * * ** * **** *** * * ****** ** * * if (str[i]>='a' && str[i]<='z')
** * * * * * **** ** *** * **** * *** * **** * ** * * ***** * ** * * *
*** * ***** **** * *
* * ** * ***** * ** * ** *** ** ** ***
* * * *** ** * * * * 0;
}
answered by (-249 points)
edited by
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 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
    char a[100];
    int i;
* ** ** * ** * ** * * * * * *
**** * * * * * ** ***** ** **
* ** * ** ** * * *** ** * * * * * * * * * * * ** ** **** *** ******
** ** ** * * * *** ** *** ** * *** * * ** ** ** * * * ** ** ***** *
*** * ** ** * **** *** * * * * *** * **** ** **** * ***** * *** ** *** * *
* ***** * *** *** * * *** ** *** * * ** * **** * *** ** ** * ** ***
** * * * *** ** *
* ******* * * * *** ** 0;
}
answered by (-284 points)
0 0
prog.c: In function 'main':
prog.c:6:5: 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__;
              ^~~~
/tmp/ccggSZJP.o: In function `main':
prog.c:(.text+0x1f): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main(){
    char c='a';
* ** ** * * *** ** * *
**** * * ****** ***** *** *
* ** * * *** * * * *** * * ** * * **** ******** * * ********* *** ** *
******* * * * * ***** ** * * **** * * ** ** * ******* * *** * *** * * *** **** *
*** * * ** ** * * ** * *** * *****
* ****** ** * * * * * * * * ****** ***** if(c<='z'&&c>='a'){
* *** * ** ** *** * * ** * ** * ** ***** * ** ** ** *** * * ** * * * ***
** *** ******* * * **** ** * ** * * ***** *
** * ** *** * *** * **** ** ** *** *** *** * *
** *** *** ** * * * * *** ** *** *** * * ***** ** *** ** ** ************ * * * *** * ***
* * * *** *** * **** * ** * ***** * *
** * ** *** *** * * * *** *** * * * **** * *
    }
    return 0;
}
answered by (-116 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()
{
    int i,t;
    char a[100];
* * * * ** * * **** ***** * * *** ** *
* ***** ** ** *** *** *** *** ** * *
**** * * * ********* *** ***** ** * *** ** ** * * *
* ** * ** ***** ********* * ** ** ** * * *** * * * * * * *** *
* ** * * * *** * *** *** * *** * ** && t>64){
* * * ** ** * * * ******* ** * *** ** ** ** * *** ** * * * ** ** * * *
** ** ** ** * ****** *** **** * * ***** * * ** * *** * ** **
** * *** *** *** ** * * * * ** * ** * ****
** * *** ** ********* **** *** * * ***** *** * * * if(t<123 && t>96){
******** ** ** ** * **** * **** ** ****** * *** * * * * ** ** * * * *
* ** ** ** *** * ** * * ** ********** * ** *** * * * * * **
* ** * *** * **** *** * ***** * * *** ***
    }
*** * * * **** **** * ** * *** * *
* *** *** * * * * * * * 0;
}
answered by (54 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
    int i,t;
    char a[100];
* * ***** * ***** *** *
** ** ***** ** * **** ** * * * * *** *****
* ** * ** ** * ** **** * * ****** * ** * * *
**** *** ******** ** * **** * * * ** * ** ** ** * ** *** **** * ***
*** * ** ** ***** *** ** ** * *** *** * *** ***** && t>64){
* * *** * ****** * ** * ** * ** * * * *** * * ** * **** ** *
** * * **** * * * ** * * * * ** *** ** *** ** * *** * * ** * ***
****** * * * * * * * * * * *** * ** **** *****
* * *** ** ** ****** * * ******* ** *** * * if(t<123 && t>96){
* **** *** **** **** * * * * * ** * * ** * * **** * * ** **
**** ** * * ** * * **** * ** ** * * *** ** *** *** * *** * * * *********
** * ** * * * **** * ** * ** ** * *** *
    }
**** ** ********* * ** * ***** **
** * * * * *** ** *** 0;
}
answered by (54 points)
0 0
prog.c: In function 'main':
prog.c:7:15: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     for(i=0;i<strlen(a);i++){
               ^~~~~~
prog.c:7:15: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:7:15: note: include '<string.h>' or provide a declaration of 'strlen'
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<string.h>

int main() {
    char in[1000];
    int len=0,i;
* ** *** **** * * ** * * ** * ***
** * * ** * * * ******* * *
** ** **** * *** * *** * * * ** {
**** *** * ** *** * ** ** ** ***** * ** **** * * ** ** * ** ** ** ******* {
** * ********** * * * ***** * * * ** ** * *** ** * ** * * * * * ** ********* in[i]+32);
* * **** ** ** *** * *** * ** * * *
* * * ** ** * * * ** ** ** * * *** * ****** *** *** * ** {
* ** *** * * ** * ** ******** * * *** * * ** **** * ****** * * ** * * in[i]-32);
* * ** * *** ** **** *** ** * * ** * *** * *
**** * * * *** * * * * * ** * * ** *** {
* * * ****** * * ** * * ** **** * * * ****** * ** *** ** * ** ***** in[i]);
*** * *** * * *** ** * * *** **
    }
}
answered by (-120 points)
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:172.69.59.83
©2016-2025

Related questions

0 like 0 dislike
27 answers
[Exercise] Coding (C) - asked Jan 11, 2018 in Chapter 13: Strings by thopd (12.1k points)
ID: 41439 - Available when: Unlimited - Due to: Unlimited
| 7k views
0 like 0 dislike
29 answers
[Exercise] Coding (C) - asked Jan 11, 2018 in Chapter 13: Strings by thopd (12.1k points)
ID: 41436 - Available when: Unlimited - Due to: Unlimited
| 6.7k views
12,783 questions
183,442 answers
172,219 comments
4,824 users