#include // First, an apology. // // For generations, Canada and the United States // have been close friends, allies, trading partners, // and neighbours. Recent political events may have... // strained...that relationship, but governments and // elections change, while approximately // 340 million Americans remain our neighbours. // // With that diplomatic formality out of the way: // // The arrangement of the stars on the flag of the // United States has changed many times as states // were admitted to the Union. // // Find an example of an official United States flag // from some point in its history and write a program // that prints asterisks in the same pattern as the // stars in the canton of that flag. // // For example, for the current 50-star flag, you // could approximate the pattern as // // * * * * * * // * * * * * // * * * * * * // * * * * * // * * * * * * // * * * * * // * * * * * * // * * * * * // * * * * * * // // or, if you want to reproduce the spacing more // faithfully: // // * * * * * * // * * * * * // * * * * * * // * * * * * // * * * * * * // * * * * * // * * * * * * // * * * * * // * * * * * * // // As another example, one arrangement used for the // 46-star flag from 1908 to 1912 can be represented // approximately as // // * * * * * * * * // * * * * * * * // * * * * * * * * // * * * * * * * * // * * * * * * * // * * * * * * * * // // Your program should use loops to generate the // pattern. Do not simply use one std::cout statement // for each row. // // You will have to determine: // // - the number of rows, // - the number of stars on each row, // - which rows, if any, must be indented, and // - how these quantities can be determined from // the loop variable. // Function declarations int main(); // Function definitions int main() { return 0; } // Hint: // // Start by examining the flag you selected. // // Look for repeated patterns. For example: // // - Do all rows contain the same number of stars? // - Do odd and even rows differ? // - Are some rows indented? // - Can the row number determine the number of // stars and whether spaces must be printed? // // Once you identify the pattern, use an outer loop // for the rows and an inner loop for the stars. // Here is one example using the 46-star pattern // shown above: /* int main() { for ( int row{ 1 }; row <= 6; ++row ) { int num_stars{ 8 }; if ( (row == 2) || (row == 5) ) { num_stars = 7; std::cout << " "; } for ( int column{ 1 }; column <= num_stars; ++column ) { std::cout << "* "; } std::cout << std::endl; } return 0; } */