i got errors and i cant find out what they meant i have went down the program line by line trying to figure them out and i am having no success. I am trying to use call by call values and parametrers n this program. (list of errors are below)
|error: at this point in file|
error: a function-definition is not allowed here before '{' token|
|error: too many arguments to function `int rand()'|
error: extraneous `int' ignored|

#include<iostream>
using namespace std;
v

oid score(int& ns1=0,int& ns2=2,int& ns3=3, int& ns4=4, int& ns5=5, int& n6=6, char gam_answ);
void display_score(int curr_score);
void roll_hold(int roll, int answer, int turn);
void turn_it_is();
void char play_again(char letter, char 'y', char 'n');
void int score(int& ns1, int& ns2, int&n s3, int& ns4, int& ns5, int& ns6, char gam_answ)
{
    int turn;
    while(char ns1=0)
    {
        cout << " next player " << ((turn % 2) ==1);
        cout << " please select r for roll and h for hold ";
        cin >> gam_answ;
        gam_answ++;
    }
}
void display_score(int curr_score)
{
    int gam_answ;
    curr_score = gam_answ++;
}
void roll_hold( char answer, int turn)
{

    if(answer=='r')
    {
        do
        {
        (rand(turn)% (char& ns1=0,char& ns2=2,char& ns3=3, char& ns4=4, char& ns5=5, char& n6=6,)+1)));
        }while(answer== 'r');
    }
        if (answer=='h')
        {
            do
            {
            system("pause");
            }while (answer=='h');
        }
void turn_it_is(int player1, int player2)
{   int ns1, ns2, ns3, ns4, ns5, ns6;
    cout << (((turn_it_is%2)==1)?(player1:player2)<<
    cout <<  " it's your turn ";
    cin>> turn_it_is;
}
char play_again( char letter, char 'y', char 'n')
{
    char 'y', 'n';
    char letter ;
    cout << " Would you like to play agian?( press y or n): ";
    cin >> letter;
    return letter;

}
i

nt main()
{
    cout << "Race to 100 " << endl;
    void score(char &ns1, char &ns2, char &ns3, char &ns4, char &ns5, char &ns6, char gam_answ);
    void display_score(int curr_score);
    void roll_hold(int roll, int answer, int turn);
    void turn_it_is(int player1, int player2);
    char play_again( char letter, char 'y', char 'n');
 return 0;

}

i got errors and i cant find out what they meant i have went down the program line by line trying to figure them out and i am having no success. I am trying to use call by call values and parametrers n this program. (list of errors are below)

|error: at this point in file|

What point in what file?

error: a function-definition is not allowed here before '{' token|

Where is here?

|error: too many arguments to function `int rand()'|

This one is obvious -- if you can find the rand() statement.

what i have to do is.......

Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions:
• roll - If the player rolls a
1: the player scores nothing and it becomes the opponent's turn (“pigging out”).
2 - 6: the number is added to the player's turn total and the player's turn continues.
• hold - The turn total is added to the player's score and it becomes the opponent's turn.

Program Structure:
Your program must have the following structural components:
• Global constants for the number of sides on a die (6) and the score needed to win (100).
• A function that displays the current score of the game. This must show the total points both players have, but not the current turn’s total.
• A function that asks the user if they would like to roll or hold. This function should return their answer. Error trap for bad values.
• A function that handles the taking of a turn. This function should work for either player. It should handle the player’s turn and update their score if they hold or win. It should not update their score if they “pig out” and roll a 1.
• A function that asks the user if they would like to play again. This function should return their answer. Error trap for bad values

new code but wit errors still

#include<iostream>
#include<ctime>
using namespace std;
void score_num(int &ns1,int &ns2,int &ns3, int &ns4, int &ns5, int &n6, char gam_answ);
void display_score(int curr_score);
void roll_hold(int roll, int answer, int turn);
void turn_it_is();
void play_again(char letter);
void score_num(int &ns1,int &ns2,int &ns3, int &ns4, int &ns5, int &n6, char gam_answ)
{
    int turn;
    while(char ns1=0)
    {
        cout << " next player " << ((turn % 2) ==1);
        cout << " please select r for roll and h for hold ";
        cin >> gam_answ;
        gam_answ++;
    }
}
void display_score(int curr_score)
{
    int gam_answ;
    curr_score = gam_answ++;
}
void roll_hold( char answer, int turn)
{
    if(answer=='r')
    {
        do
        {
        (rand(turn)% (int &ns1,int &ns2,int &ns3, int &ns4, int &ns5, int &n6)+1);
        }while(answer== 'r');
    }
        if (answer=='h')
        {
            do
            {
            system("pause");
            }while (answer=='h');
        }
void turn_it_is(int player1, int player2)
{
    cout << (((turn_it_is%2)==1)?(player1:player2)<<
    cout <<  " it's your turn ";
    cin>> turn_it_is;
}
void play_again( char letter)
{
    cout << " Would you like to play agian?( press y or n): ";
    cin >> letter;
    return letter;
}
int main()
{
    cout << "Race to 100 " << endl;
    void score_num(int &ns1,int &ns2,int &ns3, int &ns4, int &ns5, int &n6, char gam_answ);
    void display_score(int curr_score);
    void roll_hold(int roll, int answer, int turn);
    void turn_it_is(int player1, int player2);
    void play_again( char letter);
 return 0;
}

get yourself an introductory programming textbook and read how to declare, define and call functions. Or if this is homework then I would have to assume that you have some course notes on these subjects so it might be worth reading them again.

This article has been dead for over six months. Start a new discussion instead.