how do i print a colored rectangle?!?!

This is a discussion on how do i print a colored rectangle?!?! within the C++ Programming forums, part of the General Programming Boards category; i want to print a big blue rectangle let's say 25* 25 so what would be the function and the ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    4

    how do i print a colored rectangle?!?!

    i want to print a big blue rectangle let's say 25* 25
    so what would be the function and the header file?

    furthermore, i want to print a colored square on the size of the cursor (1*1) lets say the color is green for example

    what about a colored text?

    plz do send examples
    thanks in advance

    ---------------------------------------------------
    MSVC++ 6.0

    best regards

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    If you're doing it on the console, something along the lines of -

    Code:
    #include <iostream>
    #include <windows.h>
    using namespace std; 
    
    
    
    int main() {
    	
    	HANDLE h;
    	h=GetStdHandle(STD_OUTPUT_HANDLE);
    	SetConsoleTextAttribute(h,BACKGROUND_BLUE);
    	COORD start={0,0};
    	COORD t;
    	COORD end = {5,5};
    	
    	for(int i=start.X;i<end.X;++i)
    		for(int j=start.Y;j<end.Y;++j)
    		{
    			t.X=i;
    			t.Y=j;
    			SetConsoleCursorPosition(h,t);
    			cout << ' ';
    		}
    
    	return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. merging linked lists
    By scwizzo in forum C++ Programming
    Replies: 15
    Last Post: 09-14-2008, 06:07 PM
  2. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 01:13 AM
  3. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  4. What kind of programs should I start writing?
    By Macabre in forum C++ Programming
    Replies: 23
    Last Post: 04-12-2003, 09:13 PM
  5. Help With pointers in classes.
    By indigo0086 in forum C++ Programming
    Replies: 12
    Last Post: 10-10-2002, 03:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21