0 like 0 dislike
10.3k views
請設計一程式,使用者會輸入一個句子,一直到程式讀到句點”.”代表輸入結束,程式會將輸入的大寫英文字母轉成小寫、小寫英文字母轉成大寫後輸出。

輸入說明:輸入會包含英文字母、數字以及標點符號,當程式遇到句點(.)時代表輸入結束。

輸出說明:請將輸入當中的大寫字母轉成小寫,小寫字母轉成大寫,並保留其他的字元輸出。

輸入範例:

It Is A Good Day To Die.

輸出範例:

iT iS a gOOD dAY tO dIE.
[Exercise] Coding (C) - asked in 2016-1 程式設計(一)AC by (18k points)
ID: 18077 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00

reshown by | 10.3k views
0 0
Called for Help

63 Answers

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

#include * * ***
* *** main()

{
** ** * ** ** c ,a ;
* ** * ** * * * *** * ** * * ***
* ** ** *** * * ( c != '\n')

{
** * ** ** * (islower (c))
* * ***** = toupper(c) ;
* ** * * *** ** * *** * * *** a);
*** *** * * *
*** *** **** * if (isupper(c))
* * * ** *
* *** * ** = tolower (c) ;
* * ** ** ** * ******* * a);
* ***
* ** ***** ** if ** *
********* * * * ** * *
**** ** * if * * *
** **
**** ***** *** * *** * * * * **** * *
* * *


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



}




* ** ** * * 0;



}
answered by (43 points)
0 like 0 dislike
Hidden content!
#include *** ** *

#include * ** **** *
**** main()

{


**** * * ** ** c ,a ;
* * * * * ** * * * *****
** ** *** *** ( c != '\n')

{
*** ** *** * * (islower (c))
****** * ** * * = toupper(c) ;
** * **** *** *** ** ** ** a);
* *** *** *
* * * * * * ** if (isupper(c))
* * * **
* * * * = tolower (c) ;
* *** * * * ** ** **** * *** a);
* * *** ** * *
* *** * ** * * ** if *** * **
*** * *** ** *** ** ***
** ****** * * if * * ****
* *****
***** * * * * * **** * ** **** *
*** *




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





}




* ** ** * *** 0;



}
answered by (43 points)
0 like 0 dislike
Hidden content!
#include * * ** ** * **

#include *** * ** * *




** * * main(void){
***** ch ;
****
*** * * ** * * * *** = getchar();
* * ** * * * * ***** * **** == 0 * ********** ch != '\n' ** ** ch != ' ' ** * * ****** *** != 16 * * * * **** isdigit(ch) !=1)
* * ** **** * **** *** *** * * * * ** * ** ch + 32);
* ******* * * * ** * * * * **** * * if (islower(ch) == 2 **** ch != '\n' ****** *** ch != ' ' * * * * ** * ispunct(ch) != 16 ***** ***** isdigit(ch) !=1)
*** ** * ** * ***** * * * * ** ** *** ** * * * * ** *** ** ** ch - 32);
** * * * **** * *** **** * *** * *
*** * ****** * * * * ** **** ******* ** ** * * * ** **** ********* ch);


* * ****** * ** * * ****** * ** * == '.')
* * * * * * ** ***** * ** **** ** *********




*** ** * ch != '\n');






*** * ***
answered by (-122 points)
0 like 0 dislike
Hidden content!
#include ** * *** * * *

#include ** ** * * *
* *** ** main()

{


** ** * * c ,a ;
* * * ** * ******** * *** * **
* ** * * * * * ** ( c != '\n')

{
** * * * * * (islower (c))
* * * * = toupper(c) ;
** * **** *** *** * ** * * a);
*** * ****
*** * ***** * if **** * ** *
*** * * ** **
* * ***** * = tolower (c) ;
** ***** *** ** * **** * * * a);
* ** ** *
** * * *** * if ****** *
* ** * * **** ****
** *** if *
* * * ***** * * ** ** *


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





}




** * ** * * 0;



}
answered by (43 points)
0 like 0 dislike
Hidden content!
* * * ** ** ** *
* * ** ***** * ***

int main ()

 {

char c ;
**** *** ** * *

check(c);

char e;

int i = 0;

void check(char c)

{

if (islower(c))
* * **** * * *
* * * ** ** * *** * ** * **** *

  else **** ** * * *
* * * **** *** * * * *** ** * **** *

  else if(c="c")
***** * *** * ** * ** ** ** ***
*** * * * * *** **** ** if(c="d")
* * * * * ***** ** * ****
*** ** *** * * ** * ****** ** * **
** **** * **** **** ****** ******** *
* **** *** * ***** * ** * *** * ** *
** * * ** * * *** * * * ** ***
** **** ** * *** * *** * * * ** *
** * * *** * *** * *** ** ** * *
****** **** ** * *** * ** * *** * *
* * *** * * * * * * * *** * *
* ** * * ** * ** * *** *** *
* ** * ******* *** * * * *** ** *
** *** * * ** * * * *** * *
* * ** ** * * * ** ** ** * *
**** ** * **** ** * *** * *** * * * *
* * * ** *** ** ** ***** *****
* ***** *** * ** * * * if(c="l")
* *** * * * * * ** * * *** * *
* ** ** *** * * * ** if(c="m")
* ********** * * * *** ****** ***
** * * *** *** * ** * ** if(c="n")
* * ***** **** * ** * * ***
* * *** * * * * * *** ** if(c="o")
* ** * ** ** * * * **** *** *
* ** ** ** *** * ******** if(c="p")
*** * ** ** * ***** *****
*** *** **** *** *** **** if(c="q")
* *** * ***** *** *** ** ** * *
* ** *** ******* * if(c="r")
* * ** ** ***** ** ** * ** * **
** ***** * *** *** * if(c="s")
**** ** ** * * ** *** *** * *
* * * * * * ******** * if(c="t")
* * *** * *** * ** * * *** *
* **** ** **** * * * if(c="u")
* ** ** ** ** * * * * ** *** * * * *
** * ** * ** * ** if(c="v")
*** * * *** * *** ** * **
*** * * ** * ** * if(c="w")
**** * *** * ** * * * *** ****** **
* * ** * * * * * if(c="x")
** ** *** * * *** * *** ** ****** *
** ********** ** **** ** *** * if(c="y")
* ** ** **** * **** ***** ** **
** ***** * * * * * *** if(c="z")
* ** * ** * * * **** *

if (isupper(c))
* * * *** * * * * * *** * * * * * **
* * * * * * ** * * *

  else if(c="B")
** ********* * * *** * *** **

  else if(c="C")
* ** *** * * ** **** ** * * ** **
* ** * * *** * ** * * if(c="D")
********** * **** * ** ** ** ***
* * ** ***** *** * *** if(c="E")
* ** * * * * ***** **** ***** * * *
****** *** ** *** ** ** if(c="F")
** ** **** * *** * **** *** * ** * ****
**** * * * ** ** *** if(c="G")
* *** ** * ***** * ** ** * * * *
* * ** * * * ** ** **** * if(c="H")
*** **** ***** * ** ****** *
*** * **** **** * * if(c="I")
** **** * ** * ******* * ** * * *
** ** **** ** * ** * * if(c="J")
* *** ****** ** * * * * **
*** ** ****** * * ** ** * **** * * * * ***
* * * ** *** ** * ** ** * ** * ***
* ***** ** *** ** **** * *** *** * ****
* * ** * * ********* * * ** **
* ***** * * **** ** * *** ** ** ** * ******* *
** ** * ***** * * *** * **** * *** *
*** *** * * * * * * * * ** ***** *
* * ** * * * * * **** ***** *** ***
*** ** **** * * * * if(c="O")
* ** * * * ** ** * ** * * * ** *
* *** * * * * * ** if(c="P")
***** ** ** * * * *** * *** *** *
* ***** * ** * ** ****** if(c="Q")
**** **** ***** ** ** * ** * * * * * *
** ** **** *** ***** * * if(c="R")
* *** * ****** ** ** ****** *
* * ** ** * ** ** *** ****** * if(c="S")
* ** * ** * ** ** ** ** ** *
** ****** *** *** if(c="T")
** ******** ** **** **** *** *** ** ***
* * * * **** * if(c="U")
*** * * * * ******* * * *** **
* **** **** * * * * if(c="V")
* * * ***** ** * *** * *** * ** **
* *** ****** ** * if(c="W")
* * **** * **** *** * ****
******** *** * *** ***** * if(c="X")
* * ** *** ** * ** *** ** * **
* ** * * * ***** * * ** if(c="Y")
* *** ****** * **** ** ** * ***
** ** *** * * *** * if(c="Z")
* ** ** * ****** ** ** ** ** **** * *

if(isspace(c))

i++;

if(ispunct(c))

i++;

return ;

}




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

return 0;

}
answered by (-140 points)
0 like 0 dislike
Hidden content!
* * * ** **
* **** * ** * **
* * * main()

{


*** * * c ,a ;
* * * *** * * ***** *** ** *
* * ** * * ( c != '\n')

{
***** ** **** (islower (c))
* * *** ** = **** ;


* ** ** * if *
* * ** *** *** = tolower (c) ;


* ** if * ***
* ** * **** * *** * ** * * ** ** *
* *** * ** * *** * * ****

printf *** * * * ****** a);

}




*** * * * ****** 0;



}
answered by (43 points)
0 like 0 dislike
Hidden content!
#include * ****** ***
** * *** * * *** **
* * * main()

{


********** * * c ,a ;
* * * ** * * * ***** * * **** *
** **** * ** * ( c != '\n')

{
* * *** ** * (islower (c))
* *** **** = * * * ;
***** * * * * * * * **** * * *
** *** ******* * if * **
* * * ** = tolower (c) ;
*** * *** * * * *****


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

printf *** * * * * * a);

}




* ** *** *** ***** 0;



}
answered by (43 points)
0 like 0 dislike
Hidden content!
#include * ** ***** *

#include * ***** * ** *




* * main(void){
* ** ch ;
**
**** * * * ** * * *** ** *** = getchar();
* * ***** * * ***** * ** *** * * ** == 0 ***** ** ch != '\n' ** * * *** ch != ' ' ***** *** * *** * != 16)
* * * ** ** * ** * ** ** *** ** * * * ** * ** * * * ch + 32);
* ** *** * ** * *** * * ** ** * if (islower(ch) == 2 **** * *** ch != '\n' * * ch != ' ' * * ispunct(ch) != 16 )
* ** ** * *** ** * * ** ** * * ** ** *** * * * * * * * **** ch - 32);
* * ***** ** *** * ** * * * * ** **
* * * * * **** ** **** ** ** ** ** * * **** * * * *** * ** ch);


* *** **** *** * * *** *** *** == '.')
****** ** * * * ** ***** * * * * * * ******* *




** * **** ** * ch != '\n');







 }
answered by (-122 points)
0 like 0 dislike
Hidden content!
*** **** * ** *
* * ***** ** *
***** * ** * **



int main()

{
** * ****** * ** str[size],str2[size];
** *** * ** * * *
* *** * * *** * * * ** i,s1=0;
*** * * *
* * * ******* * *** ** * * * enter words:");
* * * **** *****
** * * * ** **** *
** * *** * *** ********* **** *
****** ** * * * * * ** ****
****** ** * * *
* * *** * *** ** ***
* * ****** *** * * ** ** * ** *

 
* ** *** *** * ** * ** ** 0;



}



void sam (char str[])

{
* ** ***** * * * * * ** ** i,n1=0;
* * * *** ** **** ** ** * *str1[size];
* * *** * ** **** * * *** = strlen(str);
***** *** **
* * ** ********* ** * * ** *

 {

**** * ** * ** * * *******
** * ***** * (isupper(str[i])== 0)
*** * * ** * *
* * **** ** * * ** * * ** ** = strupr(&str[i]);

* ** * * ** * * * ***** ***
* *** * * ** * * * *
*** * * * *** *
* * ** ** * ******* * ** ** ** = strlwr(&str[i]);

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

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

 }

 puts (*str1);

}
answered by (-90 points)
0 like 0 dislike
Hidden content!
#include * ** ** *

#include ** ** **




*** main(void){
* ** ** ch ;
* ** **
** * ** * **** * ** * ** = getchar();
** * *** * ** * * ********** **** == 0 * * * ** ch != '\n' ** * ** ch != ' ' * * * * * * * * * != 16)
**** ** ****** *** ** ** ** **** * ** * *** ** * ** ** ** * ch + 32);
*** *** *** * ***** * *** ** * ** ** if ** ** ** == 2 ***** * ch != '\n' * * * ch != ' ' * *** * ispunct(ch) != 16 )
*** ** * * ** **** * * * ** **** ** * ** * * ** * **** **** ** **** ch - 32);
* ** ** * **** * * ** ** ** ** *** *
* * * * ** ** ** * ** *** ** *** * * ** ** ** **** ch);




** ** * ch != '.' ** * ** ** ** ch != '\n');






* ** *
answered by (-122 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.159.115.9
©2016-2026

Related questions

0 like 0 dislike
16 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18075 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 4k views
0 like 0 dislike
86 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18071 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 13.3k views
0 like 0 dislike
49 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18070 - Available when: Unlimited - Due to: Unlimited
| 7.5k views
0 like 0 dislike
62 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18067 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 10.9k views
12,783 questions
183,442 answers
172,219 comments
4,824 users