Here is my code, it is for the game Farkle. I need help integrating the functions and setting their parameters.
#include <iostream>
#include <string>
#include <fstream>
#include <istream>
#include <cmath>
#include <cstdlib>
using namespace std;
int Pips[6]; //Array for the dice pips shown on the top of dice
bool Used[6]; //Whether the dice had been used by the scoring system or not
// Number of dice being rolls
int rollNumber = 0; //First roll? Second roll?
int number = 0
WriteResults(ostream&outs);
int main()
{
ifstream rolls("dice.txt"); // Input "dice.txt"
string num, pip;
if (!rolls) // Checking to make sure there is a file. If no file, Program breaks.
{
cout << "Unable to open" << endl;
return -1;
}
cout << "hi" << endl;
int number;
rolls >> number;
while (number != 0){//Initial while loop that will stop once the file reads a 0 in the text
for (int i = 0; i < number; i++ ){//This second loop will run the loop that takes the scores and number of pips and turns them into
rolls >> Pips[i];
}
CalculateScore();
WriteResults();
rolls >> number;
}
// Input first line of code which will be the getline fucntion
// It will get the first number which will be a 6. This 6 will be stored in var number
// Get the second line which include the number pips shown. (var number)
};
// next part is going to check for a straight
if (Pips[1] == 1 && Pips[2] == 1 && Pips[3] == 1 && Pips[4] == 1 && Pips [5] == 1 && Pips[6] ==1)
{
points = 1000;
}
else
{
for (int k = 1, k < 7, k++)
{
points += ScoringChart[k][Pips[k]];
}
}
return points;
// if it doesnt work have it check the score chart
// for the score
}
void WriteResults(ostream & outs, int number, int count, int Pips[]) // Function that will write the results
{
for (i = 0, i < number, i++)
outs << "Roll " << number << ": ";
for (k = 0, k < count, k++;)
outs << " -" << Pips[i] << "- ";
outs << endl;
}