0

Hi
I`ve just started working with graphic in c++.I want to display a stack on the console . I taugth draw a rectangle as a stack.but the problem is I don know how to draw a rectangle!
I write some codes but my compiler (Dev-c++) couldn support them. I found out they are suitable with a DOS compiler. so plz tell me how to draw a rectangle! with what library function i should do that?
thanks

3
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by William Hemsworth
0

Hi
I`ve just started working with graphic in c++.I want to display a stack on the console . I taugth draw a rectangle as a stack.but the problem is I don know how to draw a rectangle!
I write some codes but my compiler (Dev-c++) couldn support them. I found out they are suitable with a DOS compiler. so plz tell me how to draw a rectangle! with what library function i should do that?
thanks

There are lots of threads on Daniweb regarding how to draw a rectangle/box on the console. Try the search engine. Here's one:

http://www.daniweb.com/forums/thread111291.html

Regarding DOS and Dev C++, unless there is some reason to use DOS, I don't see why you would want to. What operating system are you using? I think the only library you would need is iostream.

http://www.cplusplus.com/reference/iostream/

and you'll mostly only need the cout function and endl.

http://www.cplusplus.com/reference/iostream/cout.html
http://www.cplusplus.com/reference/iostream/manipulators/endl.html

0

This will draw a temporary rectangle on the console:

#define _WIN32_WINNT 0x0500
#include<windows.h>
#include<iostream>

int main() {
	HWND console = GetConsoleWindow();
	HDC dc = GetDC(console);
	Rectangle(dc, 50, 50, 100, 100);
	ReleaseDC(console, dc);
	std::cin.ignore();
	return 0;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.