0 喜歡 0 不喜歡
3.5k 瀏覽

Please write a program that receives 7 characters aweSOME in the same line. It then changes the first 3 lowercase characters into uppercase and the last 4 uppercase characters into lowercase. Kindly use a given template to finish the task.

Example(template)

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	char s1,s2,s3,s4,s5,s6,s7; // You can change these declarations, it entirely depends on you.
	printf("Input your characters:\n"); // Do not change this

	// Your conditions start from here
	
	return 0;
}

Input

Input your characters:
aweSOME

Output

AWEsome

Suggestion

You may need a little help from your friendly table, here is ASCII table.

[練習] Coding (C) - 最新提問 分類:Chapter 3: Branching, Looping and Functions | 用戶: (5.9k 分)
ID: 29558 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 3.5k 瀏覽

13 個回答

0 喜歡 0 不喜歡
內容已隱藏
* * * * ****** * *
*** * * * * * ***

* * * **** *** ** ** ** or add * own * **** * * ** or *** */

* * * ** * ** * ** {
*** ****** * ** ** ** **** // can * * * * * * it * **** on
*** * * * ** *** * ** * ** ** *** * // Do * ** ** *

** **** * ** * // *** *** * * * ** **
**** * * * * * * **
*** **** **** * * ** * * * ** * * * *** ** * ******* ** ** * ** ** * ** * *
* * * * **
* * * * *** s1 **** * * * * **** * * s1 ** * ){
* ** * S1 = s1 + * - **
}
** * * *
****** * * * * ** * * ** * * * * * **** s1 ** ** *
* * ** ** * ** * ** ** S1 = s1 - ** - *
*** ** ** * * * }
* * * * *
* * ** ** if( s2 *** * 'a' * **** * s2 * ** 'z' ){
* * * * ** ** * ** S2 = s2 + * - *
* * *** * }
** * * * * * * * **** 'A' ** ** *** ** s2 ******
* * ** * * ** ** S2 = s2 - - * *
* * ** ** }
** * * * *
* ** ** if( s3 * *** 'a' * *** * s3 * * ){
*** * * * * *** * S3 = s3 + * -
** *** ** }
* * ** *** * * * * * * *** * * s3 ***** ***
* * * * ** ** **** S3 = s3 - ** - *
*** ** * }
* * ** *
** * * *** if( s4 * * 'a' * ******* s4 ** 'z' ){
* * * * * * * * * S4 = s4 + * -
* ** ** ** }
* ** *** * ** * * ** * s4 ** ****
* * * **** * * S4 = s4 - * * - *
* * * }
* * **
* * * * * * * s5 * **** * * ** ***** s5 * ){
* ** *** * ** ** ** S5 = s5 + * - *
**** ** **** }
* * ***** *** ** * * ** * ** s5 ****** *
* **** ** * * *** S5 = s5 - * - * **
* * * ** * }
**** * ** *
** ** ***** if( s6 * **** 'a' * ** * s6 * * ){
** * ** * * ****** ** * S6 = s6 + * * - **
* * **** }
*** * ** * * * *** *** * ***** * * ** s6 **** *
** * * * * ***** * S6 = s6 - * - *
** * * ** }
***** *** *
* * * *** * if( s7 * *** * 'a' * ** * ** s7 ** ** 'z' ){
* *** * ** ** * * ** * S7 = s7 + ** - *
** * * ** }
** * **** ** **** ****** 'A' * ** ** * * s7 * ** **
**** * * * *** * ** ** * S7 = s7 - *** - ***
* ** * * }
* ** *** **
* * * ***
** ** *** * *** *** *** * * * *** ** * *
** * ***** * 0;
}
100/100 最新回答 用戶: (221 分)
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include ** ** * *
#include ** **** *** * **

/* run this program using the console pauser or add your own getch, *** **** * * *** or input loop */

int main(int argc, char *argv[]) {
** ***** * * * * * ** * **

* ** * * ** ** ** **** ** * * * ** * your * ** * * *
* * ** * ** * *** *** * = getchar();
* * * ** * * ** * ** = ** *
** *** ** ** * * ** * = getchar();
* * * * * * * = getchar();
* * * *** * * ***** * * = * *
* * ** * * ** *** = *
* ** ** *** * **** = getchar();


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

** * ***** * ** *** * *** q >= 'a' * ***** q <= 'z' )
** *** ** * *** *** * * ** * * * ** * ** *** * q + * - 'a'));
* * * ** * *** ** ** * * ** *** * ** * * w >= 'a' * *** *** w <= 'z' )
* ** ** * *** ***** * *** * ********* * * * *** ** w + ** ** *** * - 'a'));
** * *** ** * * * * * ***** * * * **** *** * * e >= 'a' ** ** *** e <= 'z' )
* ** *** * ** * * * **** ** * ******* * *** * ** * * * ****** e + ** * * * - 'a'));
*** *** ** * ** * ** * *** * * ** * * * * r >= 'A' *** * * * * r <= 'Z' )
** * ** * ** * **** ** **** * ***** * ** * * * ** r - ** ** * * - 'a'));
* * *** ** * * * ** * *** * * * * ** ** * t >= 'A' **** ** ** * * t <= 'Z' )
* *** * ** *** * * **** **** * *** * * * * ** * ** * t - ** * - 'a'));
** ** **** ** * * ** * ** *** * * * *** * ** y >= 'A' * * **** y <= 'Z' )
* * ** ****** * ** * * * * * * ** **** ** ****** * ** ** y - ** * * - 'a'));
********** ** * ** ** * *** * *** **** ** * ** * u >= 'A' * ** *** * u <= 'Z' )
* * ** * * * * ** * * ** * * ******* * **** *** u - * * * ** * - 'a'));
* ** * *** ** * * * * * ***** ** *****
* **** * * * * * * ** *

** * *** ****** ** *
** ** ****** * ** * ** ** 0;
}
100/100 最新回答
0 0
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include **** ** *
#include ***** ** * **


int main(int argc, char *argv[]) {
* ** * ** ** ** ** * * **** q,w,e,r,t,y,u;
****** * * **** ** * * ** * *** * * * ** ** * ** * *** * your ******* *****
** * *** * * * * **** ** ** * * * ** * * * = getchar();
** ** *** * * * ** * * ** * *** * * * * * * = getchar();
* ** *** * *** *** * ** **** * ******** ** = getchar();
* ** ** **** ***** * ** *** *** * * * ** * * ** ** * * = getchar();
* * *** * *** * * * * *** * **** *** **** * * ** ** * = getchar();
* * * * ** ****** ** ** *** *** *** * ** * ** = getchar();
** * *** * ** * * ** *** * ** *** * ** * ** * * = getchar();
* ** ** ******* ** **
** * **** **** *** * ** ** * q >= 'a' * *** * * * q <= 'z' )
* ***** **** *** * * **** * *** ** * ** **** * * ** q +  ('A' - 'a'));
* ***** * * ** ** * *** * * **** *** * * w >= 'a' ** ** ***** w <= 'z' )
**** *** * * ** * ***** ** *** * * * ** * ** *** * ***** ** * w +  ('A' - 'a'));
* * * * ** * * **** **** *** * * *********** e >= 'a' ** * **** e <= 'z' )
* ***** * ****** * **** * * * ** ** * * * * * * * e +  ('A' - 'a'));
* * ** ** ** ** ** ** *** ** ** **** r >= 'A' ** * * * ** r <= 'Z' )
* ***** ** * * *** ** ** ** * *** * **** **** *** r -  ('A' - 'a'));
** * *** *** ** **** **** ** * * * ** ********* t >= 'A' * * **** * t <= 'Z' )
** * *** * *** ** ** * ** ** **** * ** *** ** ** * ***** t -  ('A' - 'a'));
***** * * **** * ***** ***** *** **** ** y >= 'A' * * * y <= 'Z' )
* ** * * ***** * * ** ** *** ** *** **** * y -  ('A' - 'a'));
**** ** * ** ** *** ** ** * * * * * * * u >= 'A' **** * * u <= 'Z' )
**** ** ***** ** ** * * ** ** * *** * ** * ** **** u -  ('A' - 'a'));
* *** **** ** ** ** ** * ** * * ** ** ** **
* * ** * * ** ** 0;
}
100/100 最新回答 用戶: (220 分)
修改於 用戶:
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include ***** * **
#include **** *** **

/* run this program using the console pauser or add your own getch, **** * * * ***** or input loop */

int main(int argc, char *argv[]) {
*** ******* ** *** * * ** * * * **

* * * * * *** * * * *** your * ** ** * *
** ******* * * * * * * = getchar();
* ** * ** * *** ** = ** *
* * * * ** * ** * * * * = getchar();
*** ** *** ** * = getchar();
** * * * * ** *** * * * = ***
* ** ** * = ** **
* ** ** * **** ******* = getchar();


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

* ** * * * ** * q >= 'a' * ** * q <= 'z' )
***** *** ***** * ** * ** *** *** ** ** * * * * ***** q + * * - 'a'));
** * * ** * ***** * * ***** * * * * ** ** * ** * * w >= 'a' * * *** w <= 'z' )
* *** * ** ** * ** * *** * * ** * * *** * * ** * * **** w + ** ** - 'a'));
* * *** * **** * ** * * * * * ** ** * * e >= 'a' **** ** e <= 'z' )
****** ** * * * ** ** * * * ** * * ***** ** * * * ** * ** e + * * - 'a'));
**** **** * * * ** * * * ** *** ** * r >= 'A' ** ** r <= 'Z' )
***** * **** *** ** ***** ** * * ** **** * *** * ** ****** r - ** * - 'a'));
* ** ***** * *** * ** **** ** **** * ** * t >= 'A' * ** *** t <= 'Z' )
* *** * ** ** ** ** ** ** * * ******* * * * * t - * *** - 'a'));
* ** * * * * *** ** ** **** ** ** * ** y >= 'A' *** * y <= 'Z' )
* ** * *** **** * * * **** * **** * ** ** *** * ** y - * - 'a'));
* * ** **** * ** * **** * * * u >= 'A' * * * * * u <= 'Z' )
******* **** * * ** * *** *** ** * * * * ** * * ** ** u - * * * ** - 'a'));
** * * ** * * ** * * **** * * * ** * ***
* * * * *** ** * * ***

** **** * * * * * *
**** * * **** **** * 0;
}
100/100 最新回答 用戶: (153 分)
0 0
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * ** *****
* **


/* run this program using the console pauser or add your own getch, * ** * ** ** ** **** or input loop */

int main(int argc, char *argv[]) {
* ** * *** * char *** ** ** // You can change these *** * * it entirely depends on you.
* * * ** ** * your * ** * * ** * * // Do not change this// Your **** start from here

* ** ** * * * * * ** = ** ***
*** ** ** ** * * = * **
** * ** ** *** *** * = ** **
* ** ** * * * * = * **
** **** * **** ** = *** *
** ** ** *** * ** *** = *** **
********* * * * **** ** * = * * *
* * **** *
*** * * *** * = **** *
* *** * * * * *** * ** ** **** *
* * * ** * ***
** *** * ** * s2 = * * * * *
** ** * ** ** ** ** * * ** ** * *
* *** * * *
* * * * * s3 = * * ***
* * ** * * ** * * ** * s3);
* * **
** * * * * s4 = *
** *** * * *** ** * * * * , s4);
* * *** * * *
* **** **** ** s5 = ** **
** ** * *** * * * *** *** * * * * *****
* * ** * * ** * * * ** *
**** ****** * ** ** * * s6 ** *
* *** ** * * **** * ** * * * s6);
** * * * * **** * *
***** ** ** * *** * * * * = s7 * * *
* * *** * ** ** * ******** * * **** *** s7);
* * *** * *** * ** * *
**** * * * *
* * * *** return 0;
}
100/100 最新回答 用戶: (283 分)
0 0
prog.c:3:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>

int main(){
* * * *** * ***** ** * * *** *** a[7];
** * ** * ****** * * * * **** * * your charaters:\n");
* **** ** * ** ***** *** * * *** * ** a);
    int i;
*** **** ** ** * * * * * *** {
**** *** ********** * *** ** * ** ** ******* **** * **** {
* *** ** * ** * ** ** ** ** * ******** ** ** * * * *** ** ** * ** * a[i]-32);
*** ****** * *** *** * ** **
** ** **** *** * * * * ** * ** * ** {
** * ** ** * * * * * * ** * * * *** * ** * * * * ******* ** ** * * * * ** * a[i]+32);
**** ** ** * * ****** * * * * ** ** * * **
    }
}
100/100 最新回答 用戶: (273 分)
修改於 用戶:
0 0
prog.c: In function 'main':
prog.c:7:13: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     int i,N=strlen(a);
             ^~~~~~
prog.c:7:13: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:7:13: note: include '<string.h>' or provide a declaration of 'strlen'
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
prog.c: In function 'main':
prog.c:6:5: error: expected ')' at end of input
     scanf("%s", a
     ^~~~~
prog.c:6:5: error: expected declaration or statement at end of input
0 0
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include * ** * * ***
#include * ** * * ***


int main(int argc, char *argv[]) {
* * * **** *** ***** * ** a, b, c, d, e, f, g;
* ** *** ****** ** * ** * ** * your *** *

**** **** *** * * ** ** ** * * * *** ** * ** * &b, &c, * ** * * * * ** *
** * **** *** * ** *
***** ** * * ** *** * * **** -= 32;
* * ** *** * * * * -= 32;
* ** * ***** ** -= 32;
* ******* ** ** * ** * += 32;
* *** * *** * * * * += 32;
* *** * *** * * *** ** += 32;
* ** * ** ** ** * * += 32;
* * * ** *** * * ***
** * ** ***** * * ** *** **** ** * *** ** a, b, c, d, e, f, g);
** * * *** * **
* * ** * * ** * * ** 0;
}
100/100 最新回答 用戶: (290 分)
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include * ** ** ***
#include * ***** *** ** *


int main(int argc, char *argv[]) {
** * * * ** ** * * a, b, c, d, e, f, g;
* ** ** * * * *** ** **** your ** * **** **

** ** * ** ******** *** **** * * * ** *** * *** &b, &c, ** * ** * *** *** * * **
** * ** *** ** ***
* * ** *** *** * * * * * -= 32;
** * * ** ** ******* ** -= 32;
** * ********* * *** * * * -= 32;
* *** * * *** * += 32;
* ** * * * * ** ***** ** ** += 32;
* ** * * * * ** ** * += 32;
* * ** ** ** += 32;
* * * * * *** * * **
** * * * **** * * *** * ** ***** ** * * * a, b, c, d, e, f, g);
* * *** ***** * ** * * * *
* ** * ** **** ** * ** * 0;
}
100/100 最新回答 用戶: (269 分)
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
* * * * * ** ****
** * ** ** *** * *


*** * * * * * {
** * * ** * a, b, c, d, e, f, g;
* * ** ** ** ** * *** *** *

** ** ** * * * **** **** * *** ** *** *** ** ** * * *** * *** **** * **** ** *
* ** ** **
* * ** ** a -= 32;
* * *** * *** b -= *
* *** *** * * c -= 32;
* *** * * d +=
** * * * e += *
*** * * f +=
** **** * *** * g += *
* **
* * ******* ** * * * * ** a, b, c, d, e, f, *
* * ***
** * * * * ** 0;
}
100/100 最新回答 用戶: (269 分)
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
***** * ** *
* **** *** *** **
** ** * ** *
** * *** * **
int main(){
**** ** *   char ***
** * * * do{
**** * * *** * ** ** * * ** **** *
** * * ** * ** ** * * * * * * ** * your *** ***
** * * **   * * * ** * * * ** *** * ** * **** *** * * ** *
** ** ** * * * **** ** * *
*** * *
*** ***** **** * * * *** * : *** *
* ***   for(int ** ****** *
* * **       string[i] = * **
***** ** * ** * ** * * ** * ** **** ***
*** * * * ** }
* * * *
** *** * * ** for(int *** ***
* * * * ** * ** * * string[i] = **** **** *
* ** **** * * ** * * * * *** * *
* ** * * ** * }
* *** ** *
**** * *
* * ***
**** * *** return 0;
}

//INPUT
* *

//OUTPUT
* ** *
100/100 最新回答 用戶: (271 分)
0 0
prog.c: In function 'main':
prog.c:10:13: warning: format '%[^
   ' expects argument of type 'char *', but argument 2 has type 'char (*)[10]' [-Wformat=]
   scanf("%[^\n]",&string);fflush(stdin);
             ^
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.241.184
©2016-2025

相關問題

0 喜歡 0 不喜歡
17 回答
[練習] Coding (C) - 最新提問 10月 27, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 29618 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 4.5k 瀏覽
0 喜歡 0 不喜歡
24 回答
[練習] Coding (C) - 最新提問 11月 2, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 30241 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 5.3k 瀏覽
0 喜歡 0 不喜歡
20 回答
[練習] Coding (C) - 最新提問 11月 2, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 30222 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 4.9k 瀏覽
1 喜歡 0 不喜歡
23 回答
[練習] Coding (C) - 最新提問 10月 20, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 28130 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 6k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶