Expand|Select|Wrap|Line Numbers
- #########
- # * #
- # * #
- #*******#
- # * #
- # * #
- #########
The aims of the exercise are to practice with while & for loops and parameter passing in C++
Expand|Select|Wrap|Line Numbers
- #include <iostream> //for cin >> and cout <<
- #include <cassert> //for assert
- #include <conio.h> //for kbhit
- using namespace std;
- //declare constants: symbols used for the drawing
- const char BLANK = ' ';
- const char BOX = '#';
- const char CROSS = '*';
- const char EOL = '\n';
- int main() //drawCrossedBox
- {
- //declare functions used
- //TO BE COMPLETED
- //declare variables
- //TO BE COMPLETED
- while ( answer == 'Y')
- {
- cout << "\nEnter the width of the box: ";
- width = getValidDimension();
- cout << "\nEnter the height of the box: ";
- height = getValidDimension();
- cout << "\n\n";
- drawHorisontalBoxBorder( width); //TO BE DEFINED
- drawVerticalCrossBranche( width, height); //TO BE DEFINED
- drawHorisontalCrossBranches( width); //TO BE DEFINED
- drawVerticalCrossBranche( width, height);
- drawHorisontalBoxBorder( width);
- checkIfWantAnotherBox( answer);
- answer = toupper(answer);
- }
- cout << "\nEND OF PROGRAM\nPress a key to continue... ";
- while ( !kbhit()); //hold the screen until a key is pressed
- return( 0);
- }