0 喜歡 0 不喜歡
1.9k 瀏覽
請完成下列函式

void reverse(int *array,int size);

該函式會將array陣列中所有元素的位置顛倒。

並寫一個主程式測試你寫的函式。
[練習] 開放式問答 - 最新提問 分類:作業 | 用戶: (18k 分)
ID: 17220 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.9k 瀏覽

20 個回答

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



int *** ** *array,int size);



{
*** * * ** *** ** **** ** i , tmp;


* **** **** * ** * ; *** * ; i++)
* * * * ** * * * **


** ******** ** ** ** * * ****** * * * * * ** * * ***** = *array[i];


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


* * ** * * *** ** * * *** ** **** * * ** * ***** * **** ** * = tmp;


**** * *** * ** *** ** * *** * * *** * ********** ** ** tmp;


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


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



}



int main(void)



{



int *** *** = {0};



int size , i ;
*** ** ****** * , * ****



for(i=0 ; *** ;i++)



{


******* *** ******** * **** * * * , *** ** *** *



}



for(i=0 ; *** ** ** * ; i++)



** * *** *** * * * * ** * * * *** , array[i]);


* *** ** , size);



* * * * ** *



return 0;



}
最新回答 用戶: (-194 分)
0 喜歡 0 不喜歡
內容已隱藏
**** * * * * *
* ** * *

int reverse(int *array,int size);

{
* * * * *** * *** ** * * i , tmp=0;
* *** * *** * * *** * ** ; i<size ; i++)
* **** * * * * ***
***** * * ** ** * * * ** * * * * *** * *** * * * ** * *** = *array[i];
***** *** *** * ** ** ** *** ** * ** ** *** ** ** *** ** * ** * *** *** **** *** = * *** * *
** ** **** ** * * *** ** * *** * * * ***** * *** ** * ** * * * = tmp;
**** *** * ** * * * * ** *** **** * * *** ** * *** * **** tmp;
** * ** *** * *** *
****** * **** ** *** *

}



int main(void)

{

int data[100] = {0};



for(i=0 ; i<size ;i++)

{
* * ** * ***** * * **** , * * * * *

}

for(i=0 ; ** * *** * ; i++)
** **** * *** ** ** ** * , array[i]);
*** * ** * * * * *** *
* * * * ** * *

return 0;

}
最新回答 用戶: (-194 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#include <stdlib.h>

int main()

{
** * * * * * *** * * * num, fibonNum;


*** *** ** * * *** *** * ** * &num);
** ** ** * * ** * = fibonacci(num);
*** * *** * * * * *** ** ** * * *** * * fibonNum);


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

}

int fibonacci(int number)

{
* ****** * **** * **** * i, num1 = 1, num2 = 1, fibon = 0;
** ***** ** ******* ***** <= 0)
*** * ** ** * **
* * **** *** ******* * **** * ** * ******* *** * * *** * * * * input positive numer");
** ***** ** *** *** * ***** * * 0;
** * **** ******** * *
** **** * *** * * * if((number == 1) || (number == 2))
** * ** * ** * ** * * * * * * * ** ** * * **** * 1;
* ***** * *** ***
*** *** ** * *
* * **** **** ***** * ***** * * ** *** *** *** * = 3; i <= number; i++)
** * * *** * * *** ** * * *****
* ** * ** *** * * *** ** *** ******* * **** * ***** * *** ** = num1 + num2;
* * * * * * * * ** * ** ******* ****** ** * * ** * * ** ** ** * = num2;
* * *** ****** * ** * * ************** * ** **** * * * ******** = fibon;
*** * * **** * *** * *** * * * * * *** * * * *** **
*** * * ** ** ***
* * ** * * * * * * ** fibon;

}
最新回答 用戶: (-64 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#include ** ***

#include <math.h>



int main()

{

int i,a,num[100]={0},temp;
******** ***** * * * **
***** * **
***** * ** * * * *
*** ** *** ***** *** ** ** *** *** ** *
* ******* **
******* * **
* * ****
* *** ** ***** * *
**** *** **** * ** * * *
*** * ** * * * * ***
* ****** ** * *
** * * ***
* **** ** * * *
* ** * *** **** * * ******** ** *
** * ** *** *

return 0;

}
最新回答 用戶: (-102 分)
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
* *** **** **

void reverse(int *array,int size)

{
** * ** ** ** ** i;
** * * ** * ** * * tmp=0;
** ** ******** *** ** *** ** **** ** * **
** ** * ** * **
* * ******* ** ** * * * * ** * ** *****
** * * * ** * **** ** * ****** *** ** *
* * * ** * * * ** * * ** ** *** * ** * * * *

   }

}



int main()

{
* *** * ** ****** n;
** * *** * ** * * * *** ** * *
* *** ** **** * array[n];
** ** ** * * ** * * i;
*** ** *** * ***** * **** *

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

   }
** * * *** * * *** *** *
**** * *** ** *** *
* * ***** * **** * ** *** * * **** * * * ",array[i]);
* ** * * * ********* ** ** ****
* *** * * *** ** * 0;

}
最新回答 用戶: (-102 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#include <stdlib.h>

void reverse(int *array, int n);

int main()

{
* * ******* * **** * * * n;
* ** * ** * ** * ** ****** ** * * **** &n);
*** * ** *** * * ** * data[n];
* * ***** * * i;
***** * **** ***** ** = 0; i < n; i++)
* * ** *** * *
* * *** ** * *** * **** * * * ** * ** * *** * ** ** ** * * ** &data[i]);
** *** ******* * **
* *** * * * * **** * ******** n);
* *********** ** ** * ** = 0; i < n; i++)
** * * * ** ** ** ** *
* * * ** * * * *** * * * * *** ***** ** * * * * *** * *** **** * ** ",data[i]);

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

}

void reverse(int *array,int n)

{
** * ** * * * * * ** * i,tmp;
**** * * * * ** * * * % 2 != 0)
* ** * * * ** *** * * *
* *** ** * *** * ** ** ** ** * ** ***** = 0; i <= n/2; i++)
** * *** ** * ** * * * * **** ***** *** ** *
* * ** ******** ** ** ** * ** ** ** * * ***** * ** * * * ** = array[i];
* ** * *** * **** * ** * ** ** ****** * * * * * * * ***** ** = array[(n-1)-i];
* *** *** ** ***** ** * * * ** * * ***** * ** *** ** * ** * *** = tmp;
* ***** ** *** * * ********* * *** **** *
* ** ** * ** ** *
**** * *** **** * ** **

    {
*** ** ** * * ** *** * *** * * * ** ** * = 0; i <= (n/2)-1; i++)
* * *** * * * * *** * *** ** * * **** *
**** ***** * *** * ** ** ** *** ** ** * * ** * ** * ** * * * ** = array[i];
* *** * *** * ** **** *** ** * * ******** * **** ** ** * ** = array[(n-1)-i];
** * ** ** **** *** * * ** * * *** ** * * * ** * **** * * **** * * *** = tmp;
* **** **** ** * **** * ** ** ** ** *
** * * *** * * *

}
最新回答 用戶: (-202 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#include <stdlib.h>



#define N 10



void reverse(int *array,int size);

int main()

{

    int ** * ** **** ** * * * * ***
* ** * * * *** * *** * *
* * * * *** **** * ******** ***** ** * ** * *** * ****** ** * ** **
* * ** ** **** ****** * * **
* * ** ** ** **** * ** * * **** **** **
*** * ** ******* * *** *** * *
* *** ** *** ** ** ** ** * *** ** * * ** * * *** ** *** * * * *
**** * ** *** * * ** *** * ** *
*** * * ** ** **** * * * 0;

}

void reverse(int *array,int size)

{
** * * *** * * * * * * ****** * tmp,i;
* * * ** * *** * *** *** * * * ** * * / 2;i++)
** * * * *** ** * *
* * ****** *** ** ** ******** *
* ** *** * *** * ** ** ** *** **** *
* * ** ***** * **** * ** * ***** **
** **** * * ***** ***** * *

}
最新回答 用戶: (-284 分)
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>

#include<stdlib.h>

void reverse(int *array,int i);

int main()

{
* * * * * ** *** * * i,j,k;
*** ****** ***** ** * * ***** * ***** * *** *
** * * * * *** * ** array[i];
* *** *** * ** **** *** * * *
* ***** *** ** **** * * * **** * **** * * * * * *


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

    


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

}



 



void reverse(int *array,int i)

{
** *** ** * * ** * ** * * l,tmp;
* * * ** * * ** * * * *** ***** * *** * ** * *
** ** * * * ** * * * * * ** ** **
** * * * * * *** ***** * *** **** ***** * *
* *** * **** * * * ***** *** * *
** *** * ******** **
最新回答 用戶: (-188 分)
0 喜歡 0 不喜歡
內容已隱藏
#include *** ** * ***

#include * * * * *** *

void reverse(int *array,int size);

int main()

{
** * * *** * * ** **** data[5]={0};
* ** * * * * **** * i;
** * * ***** ** * **** ** ** ** = 0; i < 5; i++)
* ** *** * * * *
* * ** ** ** *********** ** **** * ** * ** * * * ** *** &data[i]);
* * ** ** ***** ** *****
** * * ** *** ** **** **** * * 5);
* * *** ** ** * * ** ** * * = 0; i < 5; i++)
* **** ***** ** * ** ***
** ** ** ** * ***** ******* * *** ** ** ** * ** **** * * *** ** ",data[i]);
* * * * ** ********
* * ***** * *** ** * * * *** * ** * ** *
** * * * *** * * * ** 0;

}

void reverse(int *array,int size)

{
* ** ** * * * * * i,tmp;
*** ******* *** * *** * = 0; i <= size/2; i++)
* * * * * * * *** *
***** * * * * ** ** **** ***** * * * * * ** * * = array[i];
** * * *** *** * ** * **** ** * * *** * *** * ***** * * ** * = array[4-i];
* ** ** * * ** * * **** * ** * * ** *** ** * **** * = tmp;
** * **** * * * ** * ** **** **** *** ** ****

}
最新回答 用戶: (-202 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#include <stdlib.h>



void reverse(int *array,int size);

int main()

{
* **** * * * * * array[3]={50,100,150},i;
*** *** ***** * ** * * ** ** * * ***
*** * *** * *** ** * ** ** * ***** ** ******* *
** * ** *** * * * **** * ** * **
* * ** * * * * *** * * * *
** * * * *** ****** **** * ** * ***** ** **** ** * ** * *
* *** * ** ** * ** ** ****** **
* * * *** ** ** ** 0;

}

void reverse(int *array,int size)

{
* ** *** * *** * ***** ** ** tmp,i;
* ** * * * * * *** *** **** * * ** *
* * *** * ** * * ** ** *****
** ******** * * * *** **** *
** * * * ** * * * ***** * ***
* * ** * * ** *** * * ** * * ** * ** **
* * ****** * * **** * ** ***

}
最新回答 用戶: (-284 分)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.126.212
©2016-2025

相關問題

0 喜歡 0 不喜歡
23 回答
[練習] 開放式問答 - 最新提問 12月 22, 2016 分類:作業 | 用戶: Shun-Po (18k 分)
ID: 19793 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 2.3k 瀏覽
0 喜歡 0 不喜歡
65 回答
[練習] Coding (C) - 最新提問 11月 24, 2016 分類:作業 | 用戶: Shun-Po (18k 分)
ID: 17667 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 5.2k 瀏覽
0 喜歡 0 不喜歡
7 回答
[練習] 開放式問答 - 最新提問 12月 22, 2016 分類:作業 | 用戶: Shun-Po (18k 分)
ID: 19794 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1k 瀏覽
0 喜歡 0 不喜歡
26 回答
[練習] Coding (C) - 最新提問 11月 3, 2016 分類:作業 | 用戶: Shun-Po (18k 分)
ID: 16957 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 2.7k 瀏覽
0 喜歡 0 不喜歡
37 回答
[練習] Coding (C) - 最新提問 10月 20, 2016 分類:作業 | 用戶: Shun-Po (18k 分)
ID: 14579 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 3.2k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶