// main.cpp - Driver for the Stripe class. Print out GIP // and then reversed, PIG #include #include using namespace std; #include "stripe.h" // Add a G to the stripe void buildG(Stripe& s) { s.append("GGGG"); s.append("G "); s.append("G GG"); s.append("G G"); s.append("GGGG"); } // Add an I to the stripe void buildI(Stripe& s) { s.append("IIII"); s.append(" II "); s.append(" II "); s.append(" II "); s.append("IIII"); } // Add a P to the stripe void buildP(Stripe& s) { s.append("PPPP"); s.append("P P"); s.append("PPPP"); s.append("PP "); s.append("PP "); } // Put n spaces after each line in s void spacing(Stripe & s, int n) { string p(n, ' '); for (int row = 0; row < s.numberOfRows(); ++row) s.append(p.c_str()); } void main(void) { Stripe store; buildG(store); spacing(store, 2); buildI(store); spacing(store, 2); buildP(store); spacing(store, 2); store.printout(); store.reset(); cout << endl; buildP(store); spacing(store, 2); buildI(store); spacing(store, 2); buildG(store); spacing(store, 2); store.printout(); }