Showing posts with label Ncurses. Show all posts
Showing posts with label Ncurses. Show all posts

Monday, February 22, 2016

Basic shapes in Ncurses

First of all I will give you a brief introduction about the Ncurses.
It is a special library in C++ where you need to get downloaded from internet.It is a GUI toolkit provided that the output is not given out from normal terminal(terminal independent).It provides functions to move the cursor, create windows, produce colors, play with mouse and provide several GUI features.Hope you'll search for more details :)

Color Codes
COLOR_BLACK           0
COLOR_RED                1
COLOR_GREEN          2
COLOR_YELLOW       3
COLOR_BLUE             4
COLOR_MAGENTA   5
COLOR_CYAN            6
COLOR_WHITE         7


1)
#include<ncurses.h>
Output
 int main(){
initscr();
start_color();
init_pair(1,3,4);
attrset(COLOR_PAIR(1));
int row=5,no=1;
for(int i=1;i<=5;i++){//i=no of rows
move(row,10);
for(int j=1;j<=no;j++){
//j=no of columns
printw("* ");
}
no+=2;
//each line increment by 2 *