2 like 0 dislike
785 views
請撰寫一個程式,其程式讓使用者輸入一個字串,再讓使用者輸入的字串從尾到頭相反輸出。
範例輸入1  abcde
範例輸出1  edcba

範例輸入2  abcde12345

範例輸出2 54321edcba
[Normal] Coding (C) - asked in 2016-1 程式設計(一)AC
ID: 19745 - Available when: Unlimited - Due to: Unlimited

reshown by | 785 views

14 Answers

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



int main(){
* * *** * ** * a[80];
* ** ** * * * ** i, len, tmp;


* * * * *** ** * *** ** * * * * * a);
** * ** * * * ** * * * ** * ** a);
** ** * ** * ** * * = ***
* * ** * * ** * * * * **** * ** *** * * len);


** ** ** * ** * = 0; i < len / 2; i++){
* ** * *** ** * * ** ** *** = a[i];
* * * ** * * *** * *** * ** * * *** * = a[len - i - 1];
* ** * * ** * * ** * ** * * ***** ** - i - 1] = tmp;
* * * *** ** *
* * ** *** ** * * ** *** a);



return 0;

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

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

void * * ** ** str[]);

int length(char str[]);



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


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


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

}

void reverse(char str[]){
** *** * * *** *** ** ***
* * * ** * **** ** * ch;
** * *** *** * *** ** i = 0; i < l/2; i++ ){
*** *** * * * ** ** *** ** ** * * * * = str[i];
* * ** **** * ***** *** ***** * ** * * ** ** * = str[l-i-1];
* * *** ** * **** * ***** * ***** * * ** * = ch;
* ** ****** * * ***** * * * ***

}

int length(char str[]){
* ******* ** *** * * * * ** i=0,cnt=0;
* *** ***** * * * * *** * * * * ** * *
**** * * ** * * * *** *** * *** * * ** * ** *
*** * *** * ** * * ****
** * *** *** **** *** * ***** **** * cnt;

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


* ** *** ***



{


** * ****


* * *


** ** ** * *** *


* = *** * *


**** ** * * **


** *** % 2 == *





* (i = * * **



{
****** **

* *** * *** j = ** - i - 1;
*** * * *

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

** ** v =
* ***** * *

* * * = **
** * ** * ***

* * * * = v;
* *** **

}



}


* *



{
* ***** * * *

* (i = * ** * **** *



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

******* *** j = * - i -
* ***** * * *

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

** ****** v = **
* ** ** * *

** * * *** = ***
** ** * ***

* * * *** * = v;
*** * ** * * *

}
** * ****

}


* * ** * ** * *


**** ** ** *



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



int main ( void )

{
* *** * * *** * ** * * i , length ;
************ ** * *** ** ****** * string [80] , temp ;
* ** * * *** * *** * * * ("%s ",string );
** **** **** * ** * *** string );
* ** ** ****** * * *** * **** ** *** ** *
* * ** ** * * ***
** ** * ** ** *** ** * * * ****** ** **
* * ** * ** ** * ** ** ** * ** * ** * **** ** * ** ** *
****** ** *** ** * ** * ** * * * * *** ** [ length-i-1]=temp;
** **** * * * * ***
*** * ** * **** ** * ("%s\n ",string);
*** * * * * ***** 0;

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

Related questions

0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC by 410425014 (-162 points)
ID: 20514 - Available when: Unlimited - Due to: Unlimited
| 370 views
0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC
ID: 20997 - Available when: Unlimited - Due to: Unlimited
| 327 views
12,783 questions
183,443 answers
172,219 comments
4,824 users