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

範例輸入2  abcde12345

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

reshown by | 171 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)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.158.78.164
©2016-2020

Related questions

0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC by 410425014 (-162 points)
Available when: Unlimited - Due to: Unlimited
| 91 views
0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC
Available when: Unlimited - Due to: Unlimited
| 73 views
10,741 questions
120,626 answers
110,434 comments
3,802 users