i don't know how to color a two dimensional array( with entries 1or 0).help

Asked by vijay daga

I am a beginner in Ubuntu. I am using the 10.10 version.I have written down a program on Cellular Automata the output of which is basically a two dimensional array and each entry being 1 or 0.I want to color the 1's with some specific color(let's say black) and the 0's with some different color(let's say white).I don't know how to proceed.Please help.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :
#1

Can you tell us what language you have written this in?

Revision history for this message
vijay daga (vijay123-daga) said :
#2

I have written the program in C

Revision history for this message
mycae (mycae) said :
#3

The proper way to do it would be to use the ncurses library to control your terminal output.
http://www.gnu.org/software/ncurses/ncurses.html

The quick and dirty way to do it is to use VT100 terminal codes.
http://www.termsys.demon.co.uk/vtansi.htm

Note that using VT100 terminal codes will not work under many other platforms, such as windows, and maybe mac osx.

Finally, you may want to, instead of writing to your terminal, simply create a a sequence of images; the imagemagick library is quite helpful.
https://secure.wikimedia.org/wikipedia/en/wiki/ImageMagick

To use ncurses or imagemagick, you will need to learn how to link against external APIs.

Can you help with this problem?

Provide an answer of your own, or ask vijay daga for more information if necessary.

To post a message you must log in.