All pastes #355011 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-14 07:41 UTC
rendered paste body
////////////////////////////////////////
//                                    //
//				John Hsu			  //
//				CISY 2311			  //
//				Assignment 1		  //
//									  //
////////////////////////////////////////






#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;


//Initializing the array
int arrayOne[50];

//Define the size of the array
const int ARRAY_SIZE = 50;
const int RANDOM_MAX = 50;

//Declare the function needed for random numbers, odd numbers, and fill in the array
int randomNumbers(int& randomNumber);

int randomNumbers(int& randomNumber);

int fillRandomNumber(int arrayOne[50], int& randomNumber);

int oddNumber(int& oddNumber, int& randomNumber);

int fillOddNumber(int& randomNumber, int& oddNumber);



int main(int randomNumbers, int oddNumber, int fillRandomNumber, int fillOddNumber)
{
	//Output of the function
	cout << "The Random Number Generated is: " << fillRandomNumber << endl;

	cout << "The Odd Number Generated is: " << oddNumber << endl;
	return 0;
}

int randomNumbers(int randomNumber)
{
	// Generate Random Numbers
	unsigned int seed;
	seed = time(NULL);
	srand(seed);
	randomNumber = rand()%10;
	return true;
}


int fillRandomNumber(int arrayOne[50], int randomNumber) 
{ 
	// fill the array with random numbers 
	for(int i=0; i<ARRAY_SIZE; i++) 
	{ 
		arrayOne[50] = rand() % RANDOM_MAX;
	} 
	return arrayOne[50];
}

int oddNumber(int oddNumber, int& randomNumber)
{	
	//If modulus calculation results a none zero, it is a odd number
	if (randomNumber%2 != 0)
	{
		return oddNumber;
	}
	else
		return 0;
}


int fillOddNumber(int& randomNumber, int& oddNumber, int arrayOne[50])
{
	//Fill the array with odd numbers calculated in the previous function
	for(int i=0; i<ARRAY_SIZE; i++) 
	{		 
		arrayOne[50] = rand() % RANDOM_MAX;
	}
	return arrayOne[50];
}