C++ examples for Statement:for
Print Checkerboard Patter of Asterisks
#include <iostream> int main(int argc, const char *argv[]) { for (int i = 1; i <= 8; i++) { if (i % 2 == 0) { std::cout << ' '; }//from w w w . j a va 2s. co m for (int j = 0; j < 8; j++) { std::cout << "* "; } std::cout << std::endl; } return 0; }