i think this code may be right, but will someone check it to make sure it looks ok?
here is the project
Quote
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 a driver that will test your functions
Do not use global variables here. Pass the array to the function through the parameter list
Do not use global variables here. Pass the array to the function through the parameter list
here is the code
#include <iostream>
#include <ctime>
using namespace std;
void printFunc(int[]);
void fillFunc(int[]);
int main()
{
int random[25]; //0-24 is 25 since array indeices
srand((unsigned)time(NULL));
fillFunc(random);
printFunc(random);
return 0;
}
void fillFunc(int arr[])
{
for (int i = 1; i < 25; i++)
{
arr[i] = 1+ rand() % 10;
}
}
void printFunc(int arr[])
{
for (int i = 1; i < 25; i++)
{
cout << arr[i];
}
}


Sign In
Create Account


Back to top










