Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ code problem

Tags:

c++

I am having some problem with this code. I am trying to display... 12345 12345 12345

but I am getting an error saying...

Error 1 error C3861: 'displayOneRowOfDesign1': identifier not found

can anyone help?

// displays (on the screen) design1 
void displayDesign1 ()
{
  system ("cls"); // clears the screen

  // the entire for loop displays all three rows 
  for (int r = 1; r <= 3; r++)
  { // One iteration of the body of this loop displays row number r.
    // In other words, when r is 1, row 1 is displayed; 
    //                 when r is 2, row 2 is displayed; ...
    displayOneRowOfDesign1 ();
  }

} // displayDesign1  


// displays one row of design1; helper function to displayDesign1 
void displayOneRowOfDesign1 ()
{
  // the entire for loop displays all the columns of the row
  for (int c=1; c <= 5; c++)
  { // One iteration of this loop displays the symbol in column c
    // In other is case, when c is 1, a 1 is displayed; 
    //                   when c is 2, a 2 is displayed; ...
    cout << c;
  }

  cout << endl; // wraps up the row 
                // by sending the cursor to the next row (line)

} // displayOneRowOfDesign1  
like image 882
alex Avatar asked Feb 21 '26 13:02

alex


1 Answers

Try adding

void displayOneRowOfDesign1();

to the top of your code. This is called a "forward declaration" and is necessary because you are attempting to call that function before you have defined it.

like image 51
jjoelson Avatar answered Feb 24 '26 05:02

jjoelson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!