//CONTESTANT.H
#ifndef CONTESTANT_H
#define CONTESTANT_H
#endif
#include <iostream>
#include <string>
#include <math.h>
#include<time.h>
#include<vector>
#define CONT 12
#define EP 10
using namespace std;
class Contestant
{
private:
string name;
int charisma;
int personality;
int passion;
int techSkill;
int stam;
int randomStat;
int total;
bool competing;
public:
Contestant();
void prompt();
void randomGen();
int getStat();
};
//CONTESTANT.CPP
#include "contestant.h"
//synopsis - Contestant(), constructor for Contestant class.
Contestant::Contestant()
{
name = "NUL";
charisma = 0;
personality = 0;
passion = 0;
techSkill = 0;
stam = 0;
randomStat = 0;
total = 0;
competing = NULL;
}
void Contestant::prompt()
{
//None of this checks for errors
cout << "Please insert contestant's name\n";
cin >> name;
cout << "Please insert contestant's charisma (number between 0 - 10, where 0 is the lowest and 10 the highest)\n";
cin >> charisma;
total = total + charisma;
cout << "Please insert contestant's personality (integer number between 0 - 10, where 0 is the lowest and 10 the highest)\n";
cin >> personality;
total = total + personality;
cout << "Please insert contestant's passion (number between 0 - 10, where 0 is the lowest and 10 the highest)\n";
cin >> passion;
total = total + passion;
cout << "Please insert contestant's technical skill (number between 0 - 10, where 0 is the lowest and 10 the highest)\n";
cin >> techSkill;
total = total + techSkill;
cout << "Please insert contestant's stamina (number between 0 - 10, where 0 is the lowest and 10 the highest)\n";
cin >> stam;
total = total + stam;
randomGen();
total = total + randomStat;
}
void Contestant::randomGen()
{
srand(time(NULL));
randomStat = rand()%10;
}
int Contestant::getStat()
{
return total;
}
//RESULT.H
#include "Contestant.h"
#ifndef RESULT_H
#define RESULT_H
#endif
using namespace std;
class Result
{
private:
vector<vector <int>> judgeScore; // A vector of a vector 2D array basically
vector<vector <int>> audienceVote;
vector<vector <int>> luck; //Random factor
vector<vector <int>> total;
vector<Contestant> contestList;
public:
Result();
void display();
void calculateScore();
void genLuck();
void getContestants();
};
//RESULT.CPP
#include "result.h"
//synopsis - Result(), constructor for Result class.
Result::Result()
{
judgeScore.resize(EP);//10 episodes
for(int i = 0; i < EP; i++)
{
judgeScore[i].resize(CONT);
}
audienceVote.resize(EP);//10 episodes
for(int i = 0; i < EP; i++)
{
audienceVote[i].resize(CONT);
}
luck.resize(EP);//10 episodes
for(int i = 0; i < EP; i++)
{
luck[i].resize(CONT);
}
contestList.resize(CONT);
}
void Result::getContestants()
{
for(int i = 0; i < CONT; i++)
{
cout << "Please enter contestant number ";
cout << i + 1;
cout << "\n";
contestList[i].prompt();
}
}
void Result::calculateScore()
{
for(int j = 0; j < EP; j++)
{
for(int i = 0; i < CONT; i++)
{
((contestList[i].getStat()) + luck[j][i])/2 = judgeScore[j][i] ; //intentional cutting of integer to increase random aspect
}
}
}
//MAIN.CPP
//Always 12 contestants, always 10 episodes.
#include "Result.h"
using namespace std;
int main()
{
Result theShow;
cout << "Welcome to the XFactor. 12 contestants compete.\n Only one person may win.\n Over ten episodes.\nThe judges and our studio audience determines who wins\nEnjoy the show!";
theShow.getContestants();
}