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

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

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

輸入範例:

It Is A Good Day To Die.

輸出範例:

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

reshown by | 8.5k views

41 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<ctype.h>



int main()

{

    char c;

     
*** *** ** * * ** ** ** ***** * *************** *
* ** * * * * * * * *
**** *** *** *** **** * * != 46)
*** ***** * * **** * * * *** **
* ** * ****** ** ******* ** *** ** *** ** * * * ** **** * * - 32);
*** *** ** * * ** * * * * **
* *** * ** *** * * ** **** * * if(isupper(c))

* ** * *** * *** * ** ** * * * *** + 32);
**** *** ** * ** ****** * * **
* * ** ** **** * *** ** * ** * *
** *** * * * * *** * **** **** *** * ** * ** ***
* *** ** * * ** * * * ** ** * * ***
******* * * * * * * *** * * * ** ** * ** * ** **** *

 
***** ** ****** * ** ***** ** *
** * * * *** * ** * * * ** *** == 46)
*** * ** * ** **** * * ** ** ** ***** *
* * * * * ** *** *** ** ** * *** * * ***
* *** * * * * * ** ** ** * * 0;}
* ** * *** *** * *** *****
answered by (-264 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<ctype.h>



int main()

{

    char c;

    int i,j;
** * * ** ** *** * * * *** * ***** * *
* * * * * * * != '.')
*** ** ** * * * *** * **
** * ** * * * * * *** * * ** * * ** * **** * ** ** ****
* *** **** * *** **** *** **** **** ** *** *** *** **** * * *** = c-32;
****** * * **** * ***** **** * * ** ****** * * * **** ** * ** * * * * *****
** ** ** ***** * **** ** ** ** * * ** if(isupper(c))
** ******* * * * * * ** * ** * *** ****** * ** * ** * ***** ** ** = c+32;
** **** ** ** *********** * ** * **** * ** ** * * * ** ** ** * *** * * *
** * * ** ** * ** **** * ** ***** * **** **
* * ** ** *** ** **** ** * ** ** * * ** ** *** ****** * * * * ** * *** *** * *
* ** ** ***** * * * * * * * ***** * * ** ** **** ** *** *** * ** * * ** ** *
**** ** ** ** ** ** ** *
*** * ** * * ** **** *** *****
* * ** * * *** *** ** * 0;

    

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

#include<stdlib.h>

#include<ctype.h>



int main()

{

    char c;

    int i,j;
* * * ********** ******** ** * ** ** *
*** ****** * ***** **** * != '.')
* **** * ** ** * ** *
* ** ****** * *** *** *** ** ** ****** * **** * *** ** * *
* **** *** * *** ** *** * ** *** ** *** ** * ** *** * * ** = c-32;
***** * **** ** * * *** ** * * * * * ***** *** **** *** * * * ***** **** **** *
* * *** * * ** * ** * * * * ** ** *** ** * **** *
** **** ** * ** ** **** ** * ** * * **** * * ** * * ** = c+32;
** * * ** *** * * * ***** * * ***** **** ** ** * * ** *** * ****** * * * *****
* * * ******* * **** * ** * * ** * * ******* * ** ** * *** **** * * ** *
** * *** ** ** * ***** * *
** ** * * ****** * * **** *
* * ** ** *** ** ** 0;

    

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

#include<ctype.h>

int main()

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

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

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

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

#include<stdlib.h>

#include<ctype.h>

int main()

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


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

    {
* ** * ** ***** ** * * ** *** * ** * * * *** *** ** ** ****
** **** ** * * * * ***** * * ** ** * * *
* * * * **** *** * ** **** * * * ****** * *** * * *
* **** * **** * * * * * **** if(islower(c))
* ***** * * * ** * * ** * * * ** **
* ** ***** * * ****** * ** *** *** * * * * *
* * *** ** *** * * ** ** * ** * * *** **
* ** * * ** * ** ** * **
* ****** * * * **** *** * 0;

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

#include<string.h>

#include<stdlib.h>

int main()

{
**** ** ** *** * * i=0,n;
* *** ** * * **** * a[100];
*** ** ** * *** * * ** *

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

    }
* * * ** * * * * ** ** ** * *

    {
* * *** * *** * *** ** ** * * * * * * * ** ***** ****** ** ***** * ***** ** * ** *** * ** * * ** ***** * * * * * *** *** *** *
**** **** ** * ** * ** ** * * * * * * * * * ** ** * ** * * * *** * && a[n]<=91)||(a[n]>=97 && a[n]<=123))
* * ****** * * * * * ** * *** * ** * * ** * *** ** * *
******** *** * ** * * ** * * **** ** * * * ** * * * * * * ** * ** * ** * * ** * * * * ** ** *** ** * *** ***** * * * * **** ** **** ** *** *
* **** ** ** * * *** ** **** * * ** * ** * * * * ***** * * *** *** **** * * * * ** * * *** ** a[n]=a[n]-32;
**** ****** * * *** * ***** * ** ** * * ***** ** * ** ** * ** **
*** ** * * * * * * *** *** * * * * **** * * **** * **** ****
* ** **** * * **** *** * **** ** ** ** * **** *** *** ** ***** ** * ***** * *

    }

system("pause");

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

#include<string.h>

#include<stdlib.h>

int main()

{

    int i=0,n;
* ** * **** **** * *** a[100];
** **** ** * ** * * * * ** *

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

    }
******* *** *** * ** * * *

    {
* * * * ** * * * ** * * *** **** * * ** * ****** * **** * ** ** * ** * * * ******* * * * * *** * * * *** * **** **** **** * * ****** * *
* * * ** ****** ******** **** ** * * ** **** * * * * *** ** * * ')
* * * * * * *** * * ** ** ** ** * **** ** * **** **
** ** ** *** * * * ** **** * *** ** ** * ** * *** ****** ** * ** * ** ** *** * * * **** *** ******** ** ** *** * *** **** *** *** ***** *
** * * * * * * *** * * *** ** ***** ** * * *** ****** * ** *** ** * * *** ** * *** * * * * * ***** ** ** * * *** * a[n]=a[n]-32;
* * ** * * * ***** **** ** ** *** ** ** * * *** *** ***
* * * * *** ****** * * **** ** *** * *** ** ** **** *** ***
* *** * * ** ******* * ***** ** * ** ** *** * * * ** * * ** * ** **

    }

system("pause");

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

#include<string.h>

#include<stdlib.h>

int main()

{
***** *** *** *** * *** i=0,n;
*** * ** * ** * a[100];
* * * * * * * **** * *
**** * ** * * * ***** ** *
**** **** * ** ** * ** **** *** ***** ***** ****** * *** **** *** * * * * ** ****
** * ** *** *** ** **** * *** * * ****** *** * ** * * * *

    }
** * **** * * ** * * ** *
* ** **** **** ** ***
* ** * * ** *** * * * **** * * ***** ** * ** ****** **** ** ** * ** ** * * *
* * ** * * * *** * ** ** * ** * * **** *** * **** ** ** *** a[n]=a[n]-32;
*** ** * * ****** *** ** * *** * * * *** * * * **** ** * *** ***** *
*** * * * * ***** ** **

system("pause");

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

#include<string.h>

#include<stdlib.h>

int main()

{
********** *** ** i=0,n;
**** * *** *** * * * a[100];
** * **** ***** ** ** * * *** * ***
* *** * ** * * **** **
* ** *** * ** ** ******** * ** *********** *** **** * * ** *** * ** * * ** * ** *
* * *** * * ** * ** * * ****** ** * *** *** **** ** ****** *** * **

    }
*** *** ***** *** *** * ** * *** * *
* * * ** * * * * * *
*** * * *** * * ** * * * * * **** * * * *** * * ** * *** * * * ** *
** ***** ** *** * *** ** * * * ** *** ** ** * * * ** ***** a[n]=a[n]-32;
* *** *** ***** ******* ** * ******* * ** * * * ******* * **** ** ***** * * * *** *
****** ******** **

system("pause");

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

#include <ctype.h>



int main(void)

{
* * * * *** a;
** * *** ** ** d;
* * *** **** * ***** ***** * *** *
* * * **** * ****

   {
* * * * ** ** * **** ***
* ** ** * ** * *
**** * * ***** * ** ** * ** * ****
* **** * ** * *** **
*** ** * ** * * *
* *** * * * ** ** *
* *** * * * * * * ***** * *** * ** ******
* ** *** ** * *** * * ** * * **
** * * * * **
** * * ** **** * * **
* * ** * * * ** 0;

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

Related questions

0 like 0 dislike
5 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18074 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 2k views
0 like 0 dislike
96 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18072 - Available when: Unlimited - Due to: Unlimited
| 14.1k views
0 like 0 dislike
13 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18069 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 3k views
0 like 0 dislike
67 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AD by Shun-Po (18k points)
ID: 18068 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 10.2k views
12,783 questions
183,442 answers
172,219 comments
4,824 users