Okay, figured that much out but I'm getting compiler errors on my object (which has data members from another object)
void statistics (int rolls[];int rollsize; int rollresults [])
threedice tryerluk;
rollsize=200;
rolls[rollsize];
rollresults[16];
for (int i=0;i<201;i++)
{
tryerluk.rollem();
rolls[i]=tryerluk.getsumFaces();
}void statistics (int rolls[];int rollsize; int rollresults [])
threedice tryerluk;
rollsize=200;
rolls[rollsize];
rollresults[16];
for (int i=0;i<201;i++)
{
tryerluk.rollem();
rolls[i]=tryerluk.getsumFaces();
}
This gives me a heap of missing type specifier and syntax errors back in the threedice class data members (from class onedie) It says missing type specifier-int assumed C++ does not support default int. What am I missing? Could I have declared my classes wrong?
here is the onedie class header
class onedie
{
public:
void rollit();
int getroll();
private:
int result;
};
here is the threedice class header
class threedice
{
public:
void rollem();
int getsumFaces();
private:
onedie die1;
onedie die2;
onedie die3;
};
Here is the onedie definition (member functions)
#include "onedie.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void onedie::rollit()
{
srand(time_t(NULL));
result= 1 + rand() % 6;
}
int onedie::getroll()
{
return result;
}
and the threedice implementation
#include "onedie.h"
#include "threedice.h"
#include <iostream>
using namespace std;
void threedice::rollem()
{
die1.rollit();
die2.rollit();
die3.rollit();
}
int threedice::getsumFaces()
{
return die1.getroll()+die2.getroll()+die3.getroll()
}