Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7884015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:41:14+00:00 2026-06-03T04:41:14+00:00

I’ve run into another issue while writing this code (with MUCH help from programmers

  • 0

I’ve run into another issue while writing this code (with MUCH help from programmers here) and I’m having an issue with the program outputting the correct values. beadArrayTop should output something looking like this:

 4   *    4    *   4   *   4   *   4   *   4    *

instead it outputs that, only with 0’s where the 4’s should be.

beadArrayBottom does much of the same. I’ve tried putting the function printArray before beadArrayTop and beadArrayBottom, and even putting beadArrayTop and beadArrayBottom inside of printArray, but to no avail. Any hints on what I should do in order to make my output correct? Here is the code:

    #include <iostream>
#include <iomanip>



using namespace std;

const int MAX = 14;
void line (int &cycleCounter, int &starCounter); //outputs a star followed by six spaces
void solidLine (); //outputs a solid line of stars
void smallerLine (); //ouputs a smaller line of stars
void board (); //outputs the mancala board, with numbers indicating the bins.
void binNumbersTop (); //outputs numbers indicating the bin # (Top only).
void binNumbersBottom (); //outputs numbers indicating the bin # (Bottom only).
void beadArrayTop (); //outputs the array for the top.
void beadArrayBottom (); //outputs the array for the bottom.
void beadArrayMiddle (); //outputs the array for the end bins.
void startArray (int beadArray [MAX]); //Creates an array of 14, with 4 in every slot except for 6 and 13.
void printArray (); //Outputs the array mentioned above
int beadArray[MAX];



int main ()

{





    board ();
    cout<<endl;












    cout<<endl;
    system("pause");
    return 0;




}


//**********************************************//
void line ()
{
    int cycleCounter = 9;
    int starCounter = 6;

    while (cycleCounter > 0)
    {
        cout<<"*";


        int spaceCounter = 1;

        while (spaceCounter > 0)
        {
            cout<<"      ";
            spaceCounter = spaceCounter - 1;
            starCounter = starCounter - 1;
            cycleCounter = cycleCounter - 1;
        }
    }
}

//************************************************//
void solidLine()

{
    int loopCounter;
    loopCounter = 57;

    while (loopCounter > 0)
    {
        cout<<"*";
        loopCounter = loopCounter - 1;
    }

}   
//************************************************//
void smallerLine ()
{
    int loopCounterTwo;
    loopCounterTwo = 43;
    cout<<"*  13  ";
    while (loopCounterTwo > 0)
    {
        cout<<"*";
        loopCounterTwo = loopCounterTwo - 1;
    }
    cout<<"   6  *";
}   
//************************************************//
void binNumbersTop ()
{
    cout<<"*";
    int topNumbers = 1;
    cout << setw (7)<<"*";
    cout <<setw (4)<< 0;
    cout << setw (3)<<"*";

    while (topNumbers < 6)
    {
        cout <<setw (4)<< topNumbers;
        cout <<setw (3)<<"*";
        topNumbers = topNumbers + 1;
    }

    cout << setw (7)<<"*"<<endl;

}


//**********************************************//
void binNumbersBottom ()
{
    cout<<"*";
    int bottomNumbers = 11;
    cout << setw (7)<<"*";
    cout <<setw (4)<< 12;
    cout << setw (3)<<"*";

    while (bottomNumbers >= 7)
    {
        cout <<setw (4)<< bottomNumbers;
        cout <<setw (3)<<"*";
        bottomNumbers = bottomNumbers - 1;
    }

    cout << setw (7)<<"*"<<endl;

}

//**********************************************//

void beadArrayTop ()
{

    cout<<"*";
    cout <<setw (7)<<"*";
    cout <<setw (4) <<beadArray[0];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[1];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[2];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[3];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[4];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[5];
    cout <<setw (3) <<"*";
    cout <<setw (7) <<"*";

}
//***********************************************//
void beadArrayBottom ()
{

    cout<<"*";
    cout <<setw (4)<<beadArray[13];
    cout <<setw (3)<<"*";
    cout <<setw (4) <<beadArray[12];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[11];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[10];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[9];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[8];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[7];
    cout <<setw (3) <<"*";
    cout <<setw (4) <<beadArray[6];
    cout<< setw (3) <<"*";

}
//***********************************************//

void board ()
{



solidLine ();
cout<<endl;


line ();
cout<<endl;



binNumbersTop ();


line ();
cout<<endl;
beadArrayTop ();

cout<<endl;
line ();
cout<<endl;


smallerLine();
cout<<endl;
line ();
cout<<endl;


binNumbersBottom ();


line ();
cout<<endl;
beadArrayBottom ();
cout<<endl;
line ();
cout<<endl;





solidLine ();
cout<<endl;


}

//*********************************************//

void startArray (int beadArray[MAX])
{
    for(int i=0; i<MAX; ++i)
    {
        beadArray[i]=4;
    }
    beadArray[6]=0;
    beadArray[13]=0;
}
//*********************************************//
void printArray ()
{
    startArray (beadArray);
    for(int i=0; i<MAX; i++)
    cout << beadArray[i];
    cout<<endl<<endl;
}
//*********************************************//
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:41:15+00:00Added an answer on June 3, 2026 at 4:41 am

    You are shadowing the variable beadArray:

    void printArray ()
    {
        int beadArray[MAX];
        startArray (beadArray);
    

    Remove the int beadArray[MAX] declaration here, then the global value will be in scope, and you will be modifying it instead.

    Normally, a compiler would warn you about this. If your compiler did not warn you about this, turn up the warnings. (For gcc, I like -Wall -Wextra, though other people like to turn up the warnings even further. This is a good minimum.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am currently running into a problem where an element is coming back from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.