March 2019
Intermediate to advanced
312 pages
7h 37m
English
Let's now write a simple ncurses program for printing Hello World. I have named this program HelloWorld.cpp. The HelloWorld.cpp program can be downloaded from the Chapter05 folder of the GitHub repository:
#include <ncurses.h>#include <stdio.h>int main(){initscr(); //initializes and clear the screenint keypressed = getch(); if(keypressed == 'h' || keypressed == 'H'){printw("Hello World"); //will print Hello World message}getch();refresh(); endwin(); // frees up memory and ends ncursesreturn 0;}
The program for compiling and running a C++ program using the ncurses library is different from other programs. First, we need to understand the program. After that, we will learn how to compile and run it. ...
Read now
Unlock full access