Ok, I just changed it from '' to ' ' and your right the error is the same.
The code is 128 lines long, I cant see if there is a limit on here as to how long the code can be, so I hope its not against the rules.
Code:
#include <cstdlib>
#include <iostream>
#include <windows.h>
using namespace std;
class rectangle
{
public:
rectangle();
void set_ht(int);
void set_wth(int);
void set_col(int);
void make_rect(); //instance of rectangle with values H, W & C
int get_ht();
int get_wth();
int get_col();
int calc_area();
private:
int height;
int width;
int colour;
int area;
};
rectangle::rectangle() //constructor
{
height=0;
width=0;
colour=0;
area=0;
}
void rectangle::set_ht(int h)
{
height=h;
}
void rectangle::set_wth(int w)
{
width=w;
}
void rectangle::set_col(int c)
{
colour=c;
}
int rectangle::get_ht()
{
return height;
}
int rectangle::get_wth()
{
return width;
}
int rectangle::get_col()
{
return colour;
}
void rectangle::make_rect() //int height, int width, int colour)
{
//code for colour
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, colour);
cout<<endl;
//draw top line and corners
cout<< (char)0xDa; //corner
for(int i=0; i<width; ++i)
cout<<(char)0xC4; //horizontal line
cout<<(char)0xBF; //corner
cout<<endl;
// vertical edges
for(int i=0; i<height; ++i) //height of rectangle
{
cout<<(char)0xB3; //vertical line
for(int j=0; j<width; ++j)
cout<< ' ';
cout<<(char)0xB3;
cout<<endl;
}
//Bottom line and corners
cout<<(char)0xC0; //corner
for(int i=0; i<width; ++i)
cout<<(char)0xC4; //Horizontal line
cout<<(char)0xD9; //corner
cout<<endl;
}
//MAIN
int rectangle::calc_area()
{
area=width*height;
return area;
}
int main(int argc, char *argv[])
{
rectangle x;
int ht, wd, cl, a;
cout<< "Enter height" << endl;
cin>>ht;
x.set_wth(wd);
cout<< "Enter colour 0 to 15" << endl;
cin>>cl;
x.set_col(cl);
x.make_rect();
a=x.calc_area();
cout<<"ractangle area is " <<a<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Thats my code, as you can see its nothing special, im only in my first year.
The error is it continiously produces a colured line in an endless loop... line after line after line.
Can you see what Ive done wrong, my eyes are going square looking ((
I intend to make the class into a haeder and then run it from main by sinply including the header and then the data capture as you can see, thats why main is at the bottom... can I do it like that?