Ok, so I'm new to programming and I'm making console programs right now. I tried making a program to draw a rectangle in a cli program. I have some logical errors in the program that prevent it from working. I'm new to C++ so go easy on me. :P
/*Program by Ted. 11/03/11
Program creates a rectangle or square
in a text matrix according to user input.*/
#include <iostream>
#include <string>
#include <iomanip>
using namespace std; //variables must be greater than 2
int w1(0);
int w2(0);
int wf(0);
int h(0);
int hf(0);
int inside(0);
int inside_c(0);
int p(0);
int a(0);
bool repeat(true);
string response("");
/*Program determines expected values. to be debugged*/
int main(){
do{
cout << "Enter only whole numbers.\n";
cout << "/////////////////////////";
cout << "\n\tEnter the width: ";
cin >> w1, w2, wf, inside;
inside-=2;
inside_c = inside;
cout << "\n\tEnter the height: ";
cin >> h, hf;
h-=2;
cout << "\n" << endl;
while(w1>0){
cout << "/";
w1-=1;}//end while
cout << "\n";
while(h>0){
if(inside_c == 0){
inside_c = inside;}//end if
cout << "/";
while(inside_c>0){
cout << "*";
inside_c-=1;}//end inner loop
cout << "/\n";
h -=1;}//end while
while(w2>0){
cout << "/";
w2-=1;}//end while
p=hf+hf+wf+wf;
a=wf*hf;
cout << "\n\nThe perimeter of this shape is" << p << endl;
cout << "The area of this shape is " << a << endl;
cout << "\nEnter dimensions for another rectangle? (lowercase only) " << endl;
getline(cin, response);
if (response == "y"){
repeat = true;}
else
if (response == "n"){
repeat = false;}
else{
cout << "Response is not understood. Program will continue. ";
repeat = true;}//end if else
}while(repeat == true);
cout << "press the ENTER key to exit... ";
cin.get();
return 0;
}//end of main