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

63 Answers

0 like 0 dislike
Hidden content!
** ** * * *** * *
* * * * * * ***



int main(void)

{

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

 while(c != '.')
* ** *** * ****
*** * ** ** * * * ****** ***** *** ********** ***
* * ** ** ** * ** ** ** = toupper(c);
** *** * ** * ** * * * ** *** ***** *** ** * ** *
* ** ** * * * * = tolower(c);
* ** * *** * * * * * * * * * * * *
* * * * * *** * ****** ** * * *** **** *
* * ** * * ** *** **
***** * ** * * ***

 return 0;

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

int main(void)

{
**** ** * * ** *** ** c;
* ** ** * * ** a,b;
** ** * * **** * ** * *** * *** * * ** *
* * * * ** ** ***

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


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

return 0;

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

#include * ** * ****

int main()

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


*** ********* *** ** * ** **** * *** * *** * *
* ****** * * *** * ** *** * ( c != '.')
** * * * **** **


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

    * *** ** * *** * **** ** * * (" * ***

    }
** ** * **** *** * *** * if(islower (c))
*** ******** * *
**** **** * *** *** ***   c = toupper (c);
* **** **** ** ** * * * * * * ** * * *** ** * * * * *** ** *** * c);

    }
** * **** ** *** * * * ** * * *
*** * * *** * **** *
** ** ** * * *** ***** ***   c = tolower (c);
** * ** ** * * * * * *** * **** * * * ** ** * c);

    }


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



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

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

int main()

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

    ** * ** ** * ** ** (" * * ***

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

* * * * ** * *** * **   c = toupper (c);
***** * ** ****** * * * * *** ** ** ** ** * ** * *** * * c);

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

    }
*** * **** *
*** **** * * ***** ** ** * *** ** * ** * * *****
* *** **** **** *** ****
* ***** ******* ** * ** * * * * ** c);  
* * * * * *** ** * 0;
* ** ** * * *

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

#include * ** **

int main()

{
* ** * *** * *** ** * c;
**** ** ** *** * * a;
* * ** * * * ** * * * ** ** * * * ** **
**** * * *** * *** **** * * * = tolower ('I');
** * * * * ** ** * * ** ** * ******** c);

* **** * *** ** * = toupper ('t');
******** * * * * * * * * * ** * * ** * ***** c);

*

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

    c = tolower ('I');
** ***** ***** * * ** ** ***** c); * ** ** **
* ** * * ****** * * = toupper ('s');
** * * *** * *** * **** c);

*** * * * ** *** * **
*** * ** ** ** * * ** * = toupper (' ');
** * ** ** ***** * * * ** * * * **** c);
* * * *** ** **
** * * *** ** * * ** * = tolower ('A');
* * ** ****** ** * **** * **** * * c);

*** * ** * *** **** *
*** *** * *** ** * * * = toupper (' ');
* * * ** *** **** ** * *** * ** * * * c);
** *** ****** * ** * * *
* ** ** ** * ***** * = tolower ('G');
** ****** ** * * *** *** ** * * c);

  c = toupper ('o');
* * * * ***** ** ** * * ** ** **** * * * * c); * ** *
**** * **** c = toupper ('o');
* * * * * * * * * ** * * ** * c); * * * ** **
* * * c = toupper ('d');
* * * ** * * ** * *** * * ***** ** c);
* *** * ** *

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

* ** ** * c = tolower ('D');
*** * * ** **** * * * * c); * ** ******* * * **
* * ** * * * c = toupper ('a');
* * * ** ******** * *** * *** * ** * ** ** * * * c); * * * **** *** *
*** ** * c = toupper ('y');
* ** * * * * * * **** * * * **** c);
*** * * *** *
***** *** ***** ** = toupper (' ');
* **** ******* * ** * * * * ** c);
* * * ** ***** ***** *
* * *** ** **** *** ** = tolower ('T');
* ******** * *** *** *** ** ** * * c);
*** * ** * * * *** * = toupper ('o');
***** * ***** **** * * *** *** *** * * ** * c); ***
* * *

***** * * c = toupper (' ');
** ** * ** ** ** * ** ** * ** **** c);
** * **    
* * ** * ** ** * * * = tolower ('D');
*** * ****** ** ***** ** * ** * * c);
** ** *   c = toupper ('i');
* ** ** * * * ** ** ** * * ** *** c);  
** *   c = toupper ('e');
* ***** ***** * ** * ** * *** * * ** ** c); * * ** ** **


* *** * * ** ** **** = toupper ('.');
*** * *** * *** * *** * * **** *** ** c);


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

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

#include<string.h>

#include<stdlib.h>



main()

{
**** * * **** ** * S[5000];
* * * ** *** ***** * * * ** *** == 1)
** * ***** * ** ** *
* * ** * *** ** *** ** * ** *** * * *** * a,N = strlen(S);
**** **** *** * * * * * ** ** * ** * *** * * ** = N - 1;a >= 0;a --)
** ** ** *** **** *** ** ** *** * * * * * ** * ** * * * * >= 'a')
* * * ** **** ** * * *** * * * * *** * * ** * ** ** ** ** * * * * ** ** * **** * **** ** * *** S[a] - 'a' + 'A');
** * * *** ** ** ** * * * * ** ** *** * *** * * * ** * * * ** ***
**** ** ** * ***** * * ***** * ****** * * * *** ** **** * *** * ** * * ** * ** * ** * * S[a] + 'a' - 'A');
** ** * * *** * * * * * *** ** *** ** * ** * * ** * * ** ** * ** ** * * *

    }


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

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

#include * **

#include * * * ** **

#include * ** * **



int main(void)

{
*** * ****** * **** * a=0,b=0,d=0;
** ** *** * **** *** c;
* * * ***** * **** * ** *** * **** ** ****** * *


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

 {






*** ** **** * **** *** ** (islower(c))
* ** * * ** * * * * *** * *
** ** * ** ** ** * * * * * ** ** * ** (c));}


* * * ** ** * ** * ** ** if (isupper(c))
****** ** * * ** ** * * * ** * *
**** * * **** *** * * ** * * * * * ********* (c));}


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


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





 }






* * ** * *** * 0;

}
answered by (-136 points)
0 like 0 dislike
Hidden content!
//  Created by HoMingJui on 2016/11/3.

//



#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>

#include <math.h>





int main(){
** * *** ***** *** * ** a;
* * *** **** * * *** *** ** * ****** ** * *** *
* * * * * **** ****** * *
*** * * *** * *** ** * *** * * * *
* ** *** * * * * **** *** * * ** * ** ** ** * **** **** **** *** *** * * ***** *
***** * * * **** ** * * * * * *****
** * * * * ** * * * ** ** ** * ** * ** * *** *** *
* ** ** * * * * *** * * * ** * *** * * ******* ** * ** ** ** * ** * ** ** ** * *** **
** **** * **** * * * ** **** *** *
** ** ** * ****** * * * ** ** * *** * * * * **** **** * * * *

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

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

#include <ctype.h>



int check(char c)

{

    int i;

    i=0;
* * ** * ** * ** * **** * * *
**** * ** * * * * ** ** *** ** *** * ** * **** ****
*** * * * * * *** ** * ** i;

}



int check2(char c)

{

    int j;
* * *** * ** *** * * *
* * *** * * * ** * *
** ** * *** * *** ** ** * * ***** * *
** ** * ** * ** ***** j;

}





int main ( void )

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


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

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


** * *** *** *** * * * * ** * * * * *** * * ** ***
* ** ** ** * * ******** * * * * ***
** ** ** * * ***** * ** * * *** * * * * ** * * ** * tolower(c);
*** ** **** * * ** *** *** ** * ** ** ** * *** * ** ** * * * **
** ** * * ** ***** *** ** **** ** * *
* * ***** * ******* ** * * * * ** * ** * ** if(check2(c)==1)
** * * * *** * ***** * *** *** ** ** * * **
* *** * * * **** ** ** * **** ** * ** **** * ** *** * ** * ** * * ** *** toupper(c);
* ** * ****** * * *** * * * *** * * * * * *** * * * ** ** *** * * *** ***
* ********** * ** * * * * * * *** * * ** **** * **
*** ** * * *** * * * **** * * * * ** ** *** *
* ** ****** ** * * ** ** ********* * *** * *** * ***** ** ** * ***** ** ** * ****




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

    }





printf(".");




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

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

#include <ctype.h>



int check(char c)

{

    int i;
* *** **** ** **** ** *** *
* ** ***** **** ** ** ** ** *
** ***** ** * **** * * ** * *********
* ** ** * ** * * * * i;

}



int check2(char c)

{

    int j;

    j=0;
*** * * * * * * * * *** *
* *** *** ***** * * * ** * ** ***
****** *** ** * * ** ** j;

}





int main ( void )

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


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

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


* * * * * * ** * * * ** * *** ****** * ** * ***
*** *** * * * * * *** * * * * *** * ** ** * **
* * * **** ** ** * *** ** * ***** * * * ** ** * ** * tolower(c);
** * * * ******** * * * **** ** *** * * *** ** ** ** * * ******* * * * **** ** * *
** * ***** * * ** *** ** * * ** *
** * * * **** ** * * *** *** * * ** ** * if(check2(c)==1)
* ** ** * ** * **** * * ***** *** ** *
*** ** * ** * *** * ** **** * * * * ***** * * **** ***** *** ** toupper(c);
** **** ** ** ** *** ***** ******* ** * * ** *** * ** *** ** ** * ** ***** * **** *
**** * *** **** ** * * ** * * ** ** * *




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

    }










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

}
answered by (-186 points)
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
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
| 4.3k 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
| 14.2k 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
| 8.1k 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
| 11.9k views
12,783 questions
183,442 answers
172,219 comments
4,824 users