0 like 0 dislike
473 views
請完成下列函式

void reverse(int *array,int size);

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

並寫一個主程式測試你寫的函式。
[Exercise] Essay (Open question) - asked in 作業 by (18k points)
ID: 17220 - Available when: Unlimited - Due to: Unlimited
| 473 views

20 Answers

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



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;



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

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;

}
answered by (-194 points)
0 like 0 dislike
Hidden content!
#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;

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

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

#include <math.h>



int main()

{

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

return 0;

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

void reverse(int *array,int size)

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

   }

}



int main()

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

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

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

}
answered by (-102 points)
0 like 0 dislike
Hidden content!
#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;
** ** * *** ***** *** * ** * * *** ** * ***
* * ** *** ** * **** *

}
answered by (-202 points)
0 like 0 dislike
Hidden content!
#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++)
*** * *** ** * *** ** ** *
** ** * *** * *** ** *** * * * ***
*** * * * * * * * ** * * ** ** ** * *** **
* * *** * **** * **** * ***** ***
** * ** * * ** ** **

}
answered by (-284 points)
0 like 0 dislike
Hidden content!
#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;
* ***** **** * * * * * * ** * *** * * * ** * **
** ** *** * *** ** ** ** * * * *
* *** ****** ** * * * * **** ** * * *** * ***
*** ** * * *** * * ** ** *** * * *
** * *** * ** * ***** * * * *
answered by (-188 points)
0 like 0 dislike
Hidden content!
#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;
* ** * * ** ** * * ** * * * *

}
answered by (-202 points)
0 like 0 dislike
Hidden content!
#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;
* * * ******** ** * * ** * ***** **
** ** ** * ****** * **** *
** ** * ** * * * * ** ***** * ** ***
* * ** *** * * * * *** ** * **
* ** * ** ** * * * * ** **** *** ***
* * ***** *** * * * *** * *

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

Related questions

0 like 0 dislike
23 answers
[Exercise] Essay (Open question) - asked Dec 22, 2016 in 作業 by Shun-Po (18k points)
ID: 19793 - Available when: Unlimited - Due to: Unlimited
| 466 views
0 like 0 dislike
65 answers
[Exercise] Coding (C) - asked Nov 24, 2016 in 作業 by Shun-Po (18k points)
ID: 17667 - Available when: Unlimited - Due to: Unlimited
| 1.1k views
0 like 0 dislike
7 answers
[Exercise] Essay (Open question) - asked Dec 22, 2016 in 作業 by Shun-Po (18k points)
ID: 19794 - Available when: Unlimited - Due to: Unlimited
| 264 views
0 like 0 dislike
26 answers
[Exercise] Coding (C) - asked Nov 3, 2016 in 作業 by Shun-Po (18k points)
ID: 16957 - Available when: Unlimited - Due to: Unlimited
| 568 views
0 like 0 dislike
37 answers
[Exercise] Coding (C) - asked Oct 20, 2016 in 作業 by Shun-Po (18k points)
ID: 14579 - Available when: Unlimited - Due to: Unlimited
| 696 views
12,783 questions
183,443 answers
172,219 comments
4,824 users