(Checkerboard Pattern) Display the following checkerboard pattern with eight output statements, then display the same pattern using as few statements as possible.
Solution:
Solution:
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
cout << "* * * * * * * * \n";
cout << " * * * * * * * *\n";
cout << "* * * * * * * * \n";
cout << " * * * * * * * *\n";
cout << "* * * * * * * * \n";
cout << " * * * * * * * *\n";
cout << "* * * * * * * * \n";
cout << " * * * * * * * *\n";
cout << endl;
cout << "* * * * * * * * \n * * * * * * * *\n* * * * * * * * \n * * * * * * * *\n* * * * * * * * \n * * * * * * * *\n* * * * * * * * \n * * * * * * * *\n";
return 0;
}
Post A Comment:
0 comments: