C++代码问题

ale*_*lex 2 c++

我对这段代码有些问题.我想显示... 12345 12345 12345

但我得到一个错误说...

错误1错误C3861:'displayOneRowOfDesign1':找不到标识符

有人可以帮忙吗?

// 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  
Run Code Online (Sandbox Code Playgroud)

jjo*_*son 5

尝试添加

void displayOneRowOfDesign1();
Run Code Online (Sandbox Code Playgroud)

到你的代码顶部.这称为"前向声明",因为您在定义之前尝试调用该函数,所以这是必需的.