solidLine(); //Produces the top solid line of the game board.
endl(cout);
numbers1(); //*****************************************************************
changingNum1(beadArray); //Produces the top row of numbered tiles as well as bead count per
solidLine(); // tile. Produces the top section of the game board as well.
endl(cout); //*****************************************************************
numbers2(); //*****************************************************************
changingNum2(beadArray); //Produces the bottom row of numbered tiles as well as bead count
solidLine(); //per tile. Produces the bottom section of the game board as well.
endl(cout); //*****************************************************************
That is what board is supposed to output. I can't figure out how to make board do that at all. I don't have the strongest understanding of parameters and arguments and can't seem to find a good enough explanation for myself on google. Here is the entire program I have written so far.
#include <iostream>
#include <iomanip>
using namespace std;
const int MAX=14;
void line (); //Creates dotted line
void spaces (); // Creates spaces
void board (); // Creates board
void solidLine(); // Creates Solid Line
void numbers1(); // Creates top row of numbers
void numbers2(); // Creates bottom row of numbers
void startArray(int beadArray[MAX], int bins); //Begining array of all elements equaling '4'
void printArray(int beadArray[MAX]); //Function to print the array
int changingNum1(int beadArray[MAX]); //Function to display the top (0-6) tiles bead count
int changingNum2(int beadArray[MAX]); //Function to display the bottom (7-13) tiles bead count
int gameOver(int beadArray[MAX]);
int player(int chooseBin);
int chooseBin(int player, int beadArray[MAX], int playerNumber);
int main ()
{
int beadArray[MAX]; //Array giving each set it's beads, which is currently 0 and 4
int winnerPlayer; // Returns the winner's number 1 & 2.
int bins=4;
int highBin;
int lowBin;
startArray(beadArray, bins);
solidLine(); //Produces the top solid line of the game board.
endl(cout);
numbers1(); //*****************************************************************
changingNum1(beadArray); //Produces the top row of numbered tiles as well as bead count per
solidLine(); // tile. Produces the top section of the game board as well.
endl(cout); //*****************************************************************
numbers2(); //*****************************************************************
changingNum2(beadArray); //Produces the bottom row of numbered tiles as well as bead count
solidLine(); //per tile. Produces the bottom section of the game board as well.
endl(cout); //*****************************************************************
for(int i=8; i<MAX; i++)
{
beadArray[i]=0;
}
winnerPlayer=gameOver(beadArray);
}
/*********************************
Creates a dotted line 9 stars long
with 6 spaces inbetween
paramaters: none
return value: none
********************************/
void line () //Counts spaces inbetween stars
{
int count;
for(int group = 0; group<8; group++)
{
count = 0;
cout<<"*";
while (count<6)
{
cout<< ' ';
count++;
}
}
cout<<'*'<<endl;
}
void solidLine() // Creates a solid line of stars
{
int count;
for(count=0; count< 57; count++)
{
cout<<'*';
}
}
void board () // Creates the game board
{
int tally=0;
solidLine();
while (tally<2)
{
int count;
for(count=0;count<5;count++)
{
line();
}
tally++;
solidLine();
endl(cout);
}
}
void numbers1() // creates first level of numbers from 0-6
{
int count;
line();
cout<<"* *";
//Goes from 0-6
for (count = 0; count<6; count++)
{
cout<<setw(4)<<count<<setw(3)<<"*";
}
cout<<" 6 *"<<endl;
for(count=0; count<2; count++)
{
line();
}
}
void numbers2() // Creates second level of numbers from 7-13
{
int count;
line();
cout<<"* 13 *";
//Goes from 0-6
for (count = 12; count>6; count--)
{
cout<<setw(4)<<count<<setw(3)<<"*";
}
cout<<" *"<<endl;
for(count=0; count<3; count++)
{
line();
}
}
void printArray(int beadArray[MAX]) //Function to print the array
{
for (int i=0; i<=13; i++) //Loop to print the beadArray
{
cout<<' '<<beadArray[i];
}
}
int changingNum1(int beadArray[MAX]) // creates first level of changing numbers from 0-6
{
int count;
cout<<"* *";
//Goes from 0-6
for (count = 0; count<7; count++)
{
cout<<setw(3)<<beadArray[count]<<setw(4)<<"*";
}
for(count=0; count<1; count++)
{
endl( cout);
line();
}
}
int changingNum2(int beadArray[MAX]) // creates second level of changing numbers from 7-13
{
int count;
//Goes from 7-13
for (count = 13; count>6; count--)
{
cout<<"*"<<setw(3)<<beadArray[count]<<setw(4);
}
cout<<" * *";
for(count=0; count<1; count++)
{
endl( cout);
line();
}
}
void startArray(int beadArray[MAX], int bins)
{
for (int i=0; i<MAX; i++)
{
beadArray[i]=bins;
}
beadArray[6]=0;
beadArray[13]=0;
}
int gameOver(int beadArray[MAX])
{
int leftOver=0;
int endGame;
for (int i=0; beadArray[i]==0 && i<7; i++)
{
endGame=1;
}
for (int i=8; beadArray[i]==0 && i<MAX; i++)
{
endGame=2;
}
cout<<endGame;
if (endGame==1)
{
for(int i=8; i<MAX; i++)
{
beadArray[i]=++leftOver;
}
}
if (endGame==2)
{
for(int i=0; i<6; i++)
{
beadArray[i]=++leftOver;
}
}
cout<<"the leftover is "<<leftOver;
return endGame;
}
int chooseBin(int playerNumber, int player, int beadArray[MAX])
{
int bin=0;
if ( playerNumber==1)
{
cout<<"What bin number do you choose?";
cin>>bin;
}
if (bin>0&& bin<<6)
{
cin>>bin;
}
else
{
cout<<"Number must be inbetween 1 and 5.";
}
if (playerNumber ==2)
{
cout<<"What bin number do you choose?";
cin>>bin;
}
if (bin>7 &&bin<<13)
{
cin>>bin;
}
else
{
cout<<"Number must be inbetween 7 and 12.";
}
}
int player(int changingNum1, int changingNum2)
{
int playerNumber=0;
int turnOver=0;
if (changingNum1 ==0 && changingNum2==0)
{
if (turnOver==1 && playerNumber==1)
{
playerNumber=2;
turnOver=0;
}
else if(playerNumber==2 && turnOver==1)
{
playerNumber=1;
turnOver=0;
}
}
}

New Topic/Question
Reply



MultiQuote




|