Pages

C++ Ncurses Tutorials - Lesson 1

        Basics of Ncurses in C++ Progmming (Lesson 1)


Those who dosen't know about Ncurses, I want to said  you first, Ncurses is not that kind of hard thing to learn and also, learning Ncurses Is pretty fun!

First we need to include HEADER FILE of Ncurses.

#include "ncurses.h"



Then after MAIN() you should type INITSCR(),  also  before the RETURN 0; you should type,

GETCH()   - To hold system
ENDWIN() - End the Ncurses programme
PRINTW(" ") - To Print a text (similar to cout in "iostream" header)
MOVE(x,y) - We can use this to Move our courser anywhere inside a programme



Example Programme


#include "ncurses.h"
int main()
{
    initscr();
    move(4,50);
    printw("Hai There");
    move(4,9);
    printw("Welcome");
    move(4,20);
    printw("I am c++");

    getch();
    endwin();

return 0;
}

Type and compile your programme and see what happening 

g++ compilation - g++ -oexe "name".cpp -lncurses