#include <iostream> #include <iomanip> #include <cstdlib> #include \"aRandomNumb
ID: 3619186 • Letter: #
Question
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include "aRandomNumberGenerator.h"
using namespace std;
int main()
{
aRandomNumberGenerator number(110);
cout << endl;
cout << endl;
system ("pause");
return 0;
// constructor
aRandomNumberGenerator::aRandomNumberGenerator(intnum)
{
setSeed(num); // call setfunction to initialize seed
}
// destructor
aRandomNumberGenerator::~aRandomNumberGenerator()
{
}
// sets the seed of the generator, has no returnvalue
void setSeed(int num)
{
seed = num; // store thenumber passed as the seed
}
// generates a set of 10 random numbers basedoff the seed
int generate()
{
srand(seed);
for (int counter = 0; counter <10; counter++)
{
cout << setw(6) <<rand();
}
}
Explanation / Answer
please rate - thanks I like asking the user. sorry I don't work with header files. you didn't define many things. function prototypes, class members etc never called generate hope this helps, message me if any problems #include #include #include using namespace std; class aRandomNumberGenerator {public: aRandomNumberGenerator(int num); ~aRandomNumberGenerator(); int generate(); void setSeed(int num); private: int seed; // constructor }; aRandomNumberGenerator::aRandomNumberGenerator(int num) { setSeed(num); // call set function to initialize seed } // destructor aRandomNumberGenerator::~aRandomNumberGenerator() { } // sets the seed of the generator, has no return value void aRandomNumberGenerator:: setSeed(int num) { seed = num; // store the number passed as the seed } // generates a set of 10 random numbers based off the seed int aRandomNumberGenerator::generate() { srand(seed); for (int counter = 0; counter < 10; counter++) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.