2015-10-06 84 views
1

這是我到目前爲止,我得到一個錯誤:setw沒有在此範圍內製作一個6x6的網格,二維數組

void grid (void) 
{ 
    for (int r = 0; r < 6; r++) 
    { 
     for (int c = 0; c < 6; c++) 
     { 
      cout << "-------------" << endl; 
      cout << "|" << setw(4) << r + 1 << setw(4) << "|" << endl; 
      cout << "-------------" << endl; 
     } 
    } 
    cout << "-------------------------------"; 
} 

回答

0

setwiomanipiostream定義聲明。因此,添加此行到您的源文件:

#include <iomanip> 
+0

我意識到並添加了它,但是,網格仍然沒有打印它應該的方式。無論如何,我可以發送一張應該看起來如何的照片嗎? – Shay