0 like 0 dislike
7.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 | 7.3k views
0 0
Called for Help

63 Answers

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

#include * ** * ***




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




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






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

#include ** ** * * *



int main()

{
* * ** ** * ** * * *** a[9999];
* ** * **** * * * i;
**** * * **** ** * * * ** *** ** a);
* ** * * ** ***** * (i = 0; a[i] != '\0'; i++)
*** * *** ***** *** * *****
** * ** * *** * * ** * ** * **** * * ('a' * *** a[i] ***** * a[i] <= 'z')


****** ** *** **** * ** *** * ** * ****** ***** * ** * (a[i] - * ***




* *** *** ** ** * * * **** * ** ** * * *** **** if('A' <= a[i] *** *** ** * a[i] <= 'Z')


* ** *** * * * ** * *** * ** * * * * ** * * *** * * ***** - 'A')+'a' );


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


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

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

int main(void)

{
******* ** ** c;


** * ** ** * * **** * **
* ** * *** *** = toupper('islower(c)');
* * ****** * * *** * * * c);
** * * * *** * 0;


** ** * * * * * **** *
* * ** * * *** = tolower('isupper(c)');
** * ** * * *********** * **** ** c);
* ** * * * ** 0;



}
answered by (-40 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>



int main(void)

 {
* * * **** ***** * *** c[500];

     int in,a,b;
* **** ***** *** * * * * ** * *



     {
* * * * * **** ** * *** * * * ** * * *** ** * **** ** c[in];in++)
***** ** * * * * ** *** **** * * ** * * * * * **
* ** ** *** ** * ** ** **** * * * * ** * ** ** && c[in]<=90)
* *** ** * * * * *** ** *** ** * ****** ***** * **** **** c[in]=a;
** ******** * **** ** * ***** ** ** **** ** * * * ****** ***** ****** ***
* *** *** ** *** * * * *** ***** ** * * * ** * * * * * * * * * * ****** **


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


* * ***** ** ** * * **** * * * ** *** ** *** if (97<=c[in] && c[in]<=122)
** **** * **** * * * *** * * ** * ** **** * *** * ** * *
*** * * * * ****** *** ** ***** *** **** * * ** * * * *** * ** ** **
* * * *** *** **** * ** ** ** **** ** *** ** ** *** ** * * * * **** * * ** *
* * * *** * **** **** ** * * * **** * * * ** * * *** ** ** * * ***


* * * ** * ** *** *** ** *** ** **** * ** * ** *
**** ** ** * * ** *** *** ** * *** *
* * **** ** * * * * ** ** ** * *** ** (c[in]==46)
* * * * **** * * * *** *** ***** **** *** * 0;



     }
**** ** * * *** ** **** *** ** 0;

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

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

#include ******* *





void check (char c)

{
***** i,j;
* * ** ** **** * ** * ** **
* ** ** ** * **
* * * *** * * *****
* ** * * ** = * ***
* * * ** * * **
* *** **** *** = **** ***
* * *
** ***** * ;


* ** *
answered by (-50 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <ctype.h>

int main()

{
* ** ** * * ** *** c ;

   int i=1,j=0;
***** ** *** ** * ** * * * * * **** *
***** * * ** * != '.')

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


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

   }
* ** ** ** * **** ** **** * ****
** * *** * *** 0;

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

int main(void)

{
** * * ** * ** c;


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

  {
**** *** **** ** = toupper('(c)');
* * *** ** * ** **** * * ****** c);
** * * * *
* * * *** * * *
**** *** ****
**** ** ****** ** = tolower('(c)');
* **** **** * ** * *** ** * c);
* * * *
* *** 0;

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

{


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

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


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

}


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



}
answered by (43 points)
0 like 0 dislike
Hidden content!
** ***** ** * **** * ** * * <stdio.h>





int main()

{

   char userinput;
* ** ** * ** * * *** * ** **** * *** ** * ** *
** * ***** ** * * ** ** * ** * ***


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

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

}

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

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

}

   else{
* * **** * * * * * * * ******** * * **

   }


** * ** ***** * * ** **** * ******* * ** *
answered by (-74 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<ctype.h>

int main()

{
* ** ** * * *** c ;
* ** * ** * ** * * ***** * * *** * *** &c) ;
*** * * * ** * ** * != '.')

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


* *** ***** ** ** ** * * * * * *** ***** &c) ;
* * ** * * * * *******
* ******** * ** * * * * *
* *** * ** * ** * 0 ;

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

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
| 2.7k 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
| 8.9k 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
| 5.2k 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
| 7.2k views
12,783 questions
183,442 answers
172,219 comments
4,824 users