Rectangle Help
Sep 6, 2014 at 5:37pm UTC
Hey guys, I'm having a bit of trouble here.
I am trying to create a rectangle generator using - and |.
However, when I run it, I enter the length and width and it is completely messed up, anyone?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
//Geo
#include "stdafx.h"
#include <iostream>
#include <string>
#include "g_var.h" //Gvar has extern g_l and g_w, being int values,
//They are used through the main function, which changes the
int draw_Length() //The values
{
using namespace std;
for (int i=0; i<=g_l; i++)
cout << "-" ;
for (int i=0; i<=g_w; i++)
cout << "\n" ;
for (int i=0; i<=g_l; i++)
cout << "-" ;
return 0;
}
int draw_Width()
{
using namespace std;
for (int i=0; i<=g_w; i++)
{
cout << "|" << endl;
cout << "\n" << endl;
}
for (int i=0; i<=g_w; i++)
{
for (int i=0; i<=g_l; i++)
cout << " " << endl;
cout << "|\n" << endl;
}
return 0;
}
Last edited on Sep 6, 2014 at 6:04pm UTC
Topic archived. No new replies allowed.