C++ Print A Box Application -
i'm working on c++ project prints box screen based on user's entered width , height input. can far print out top, bottom, , left side dots on screen. thing need printing out far right dots. i've provided screen shot of output below code.
code:
#include <iostream> using namespace std; int main() { int width; int height; //introduction: cout<<"welcome [draw rectangle] program!\n"; cout<<"this program draw rectangle in application\n"; cout<<"you have enter width , height , draw it\n"; //user enters box width , height: cout<<"please enter width: "; cin>>width; cout<<"please enter height: "; cin>>height; //prints top dots (horizontal): (int dots; dots <= width; dots++) { cout<<"*"; } //prints left dots (vertical): (int dots; dots < height; dots++) { cout<<"*\n"; } //prints bottom dots (horizontal): (int dots; dots <= width + 1; dots++) { cout<<"*"; } //keeps program running: cin.get(); }
screenshot:
as can see dots not printing on far right side , box incomplete, , need fixed, helps, please!
based on width entered, when insert left dot, insert appropriate number of spaces , right dot. put newline after right dot.
Comments
Post a Comment