Question: Using online gdb . com, please write a C code, and please SHOW PRROF OF SCREENSHOT of how to get this code to work because
Using online gdbcom, please write a C code, and please SHOW PRROF OF SCREENSHOT of how to get this code to work because the code i have doesn't work! Please take screenshots of output, i am lost and need this code to work!
What to do
Write a C program matrix that uses the curses library to create a a Matrixstyle effect.
A random row of numbers that consist of and space character will be generated and move down
to create this effect.
The numbers will continue to fall down until the user presses CtrlC at which time the program will clear
up the screen and terminate.
matrix can be used as follows:
speed can range from to and indicates how fast the numbers are moving down.
code:
#include
#include
#include
#include
Signal handler for CtrlC
void handlesigintint sig
endwin;
exit;
int mainint argc, char argv
if argc
printfUsage: s speed
argv;
return ;
int speed atoiargv;
if speed speed
printfSpeed must be between and
;
return ;
Initialize curses
initscr;
cbreak;
noecho;
cursset;
timeout speed; Adjust speed
srandtimeNULL; Seed the random number generator
Set up signal handler for CtrlC
signalSIGINT handlesigint;
int maxx maxy;
getmaxyxstdscr maxy maxx;
while
for int x ; x maxx; x
int r rand;
char ch r : r : ;
mvaddch x ch;
scrollokstdscr TRUE;
scrl;
refresh;
End curses mode
endwin;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
