The goal is to create 25 random numbers in between 0 and 99 and place them into two lists which tells the user if they are even or odd. I cant get it to put the numbers into even and odd vectors.
#include<iostream>
#include<vector>
usingnamespace std;
int random(int v1)
//generates 25 random numbers between 0 and 99
{
for (int count=0; count<25; count++) //counts up to 25 so only 25 numbers are generated
{
v1 = rand() % 100; // v1 is the range 0 to 99
cout<<v1<<endl;
}
return(v1); //passes v1 into num variable in the main function
}
int main()
{
int num=0;
random(num);
int even=0;
int odd=0;
vector<int>evennum(25); //this is the vector for even numbers they each could have 25 numbers stored
vector<int>oddnum(25); // this is the vector for odd numbers they each could have 25 numbers stored
// displays the 25 numbers
int remainder = num % 2; // determines if the remainder is even
if (remainder==0) //if the number is even it is added into the even vector
{
evennum[even] = num; //takes in the number of odd numbers and stores them in evennum
even++; //counts the number of even numbers
evennum; //outputs the numbers
}
else //if the number is not even it is placed in the odd vector
{
oddnum[odd] = num; //takes in the number of odd numbers and stores them in oddnum
odd++; //count the number of odd numbers
oddnum; //outputs the numbers
}
return(0);
}