正在加载图片...
int main() int numbers[1000]; int **odds,**evens: int *numOdds,*numEvens; Init(numbers,1000); Partition(numbers,1000,evens,numEvens,odds,numOdds); delete (evens); delete (odds); } void Init(int array[],int n) inti; RandomT randInt; for (i=0;i<n;i++) { array[i]RandInt.nextlnteger(1,1000): Problem 4:Practice function-tracing problems Trace through functions and show the output produced. Problem 4a) 快 File:ptrtrace.c This file does nothing useful and exists only to test your understanding of pointers. * #include <iostream> #include <string> using namespace std /*Private function prototypes * static void Bizarre(int *p1,int *p2,int n); static int *Weird(int array[,int n); static void Checkpoint(int ckpt,int array[,int n); /*Statically initialized arrays * static int a10={100,200,300,400,500; static int a20={3,4,0.1.2};int main() { int numbers[1000]; int **odds, **evens; int *numOdds, *numEvens; Init(numbers, 1000); Partition(numbers, 1000, evens, numEvens, odds, numOdds); delete (evens); delete (odds); } void Init(int array[], int n) { int i; RandomT randInt; for (i = 0; i < n; i++) { array[i] = RandInt.nextInteger(1, 1000); } } Problem 4: Practice function-tracing problems Trace through functions and show the output produced. Problem 4a) /* * File: ptrtrace.c * ---------------- * This file does nothing useful and exists only to test your * understanding of pointers. */ #include <iostream> #include <string> using namespace std; /* Private function prototypes */ static void Bizarre(int *p1, int *p2, int n); static int *Weird(int array[], int n); static void Checkpoint(int ckpt, int array[], int n); /* Statically initialized arrays */ static int a1[] = { 100, 200, 300, 400, 500 }; static int a2[] = { 3, 4, 0, 1, 2 };
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有