They do put the tutors for C++ at the most inconvenient times at my college... Anyways, the instructor posted the following directions:
"Write a function that will fill an array with 25 random numbers between 1 and 10. Then write a function that will print out the array. Write some code in main to test your functions. Sometimes this test code is called a *driver
Do not use global variables here. Pass the array to the function through the parameter list"
My current code does not result in any errors int he debugger, but it doesn't output the array. And I don't know what he means by writing the driver, what am I supposed to test? You've all proved to be exceedingly helpful in the past and I'm sure you'll help point me in the right direction this time
"Write a function that will fill an array with 25 random numbers between 1 and 10. Then write a function that will print out the array. Write some code in main to test your functions. Sometimes this test code is called a *driver
Do not use global variables here. Pass the array to the function through the parameter list"
My current code does not result in any errors int he debugger, but it doesn't output the array. And I don't know what he means by writing the driver, what am I supposed to test? You've all proved to be exceedingly helpful in the past and I'm sure you'll help point me in the right direction this time
Code:
#include <iostream>
#include <ctime>
using namespace std;
double print(double array);
double produce();
int main()
{
double produce();
double print();
}
double produce()
{
srand(time(0));
double array[25];
for(int i=0; i<25; i++)
{
array[i] = (rand()%10)+1;
cout << array[i] << endl;
}
return *array;
}
double print (int array)
{
cout << array << endl;
}