Source Code File 08-01_yourname
08-01_yourname.c
#include <ncurses.h>
int main()
{
char name[32];
int ch;
initscr();
do
{
clear();
addstr("Enter your name: ");
getnstr(name,31);
move(1,0);
printw("Your name is %s. ",name);
printw("Is this correct? ");
ch = getch();
} while( ch != 'y');
move(2,0);
printw("Pleased to meet you, %s\n",name);
getch();
endwin();
return 0;
}
Output Screenshot

Notes
* This code is an example of a "yorn" problem, "yes-or-no." You have many options for coding a yorn program. This could could have also tested for uppercase Y, for example.
Copyright © 1997-2025 by QPBC.
All rights reserved
