Mod_1
goal : slowly change existed code example for learning
setw
fill width 6 blank box %%%%%% , %%%%HI
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
const int columnLimit = 4;
const int width = 6;
int row;
int column;
for ( row = 1; row <= 10; row ++)
{
for ( column =1 ; column <= columnLimit; column++ ){
// modify this.
if ( row * column % 3 == 0 )//3n -> change to '@'
{
cout << setw(width) << '@';
}
else
cout << setw(width) << row * column;
}
cout << std::endl;
}
cin.get();
return 0;
}
result:
댓글 없음:
댓글 쓰기