- Nov 16, 2000
- 8,660
- 1
- 81
This program needs to return a specifed number of math programs...
But, when I specify a certain number of problems, it will just print out the same problem the specifed amount of times?
Any help? Perhaps I need to set return types?
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
void numbers(int &, int& );
void output(int, int);
void control(int, int &, int &);
void main()
{
int times=0;
int num1=0, num2=0;
control(times, num1, num2);
}
void numbers(int &x, int &y)
{
srand(time(0));
x = (1 + rand()%1000);
y = (1 + rand()%1000);
}
void output(int x, int y)
{
cout << x << " + " << y << " = " << endl;
}
void control(int x, int &y, int &z)
{
cout << "How many problems to create? " << endl;
cin >> x;
for(int i=1; i<=x; i++)
{
numbers(y, z);
output(y,z);
}
}
But, when I specify a certain number of problems, it will just print out the same problem the specifed amount of times?
Any help? Perhaps I need to set return types?
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
void numbers(int &, int& );
void output(int, int);
void control(int, int &, int &);
void main()
{
int times=0;
int num1=0, num2=0;
control(times, num1, num2);
}
void numbers(int &x, int &y)
{
srand(time(0));
x = (1 + rand()%1000);
y = (1 + rand()%1000);
}
void output(int x, int y)
{
cout << x << " + " << y << " = " << endl;
}
void control(int x, int &y, int &z)
{
cout << "How many problems to create? " << endl;
cin >> x;
for(int i=1; i<=x; i++)
{
numbers(y, z);
output(y,z);
}
}
