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 gdb.com, 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 Matrix-style effect.
A random row of numbers that consist of "0","1", and space character will be generated and move down
to create this effect.
The numbers will continue to fall down until the user presses Ctrl-C, at which time the program will clear
up the screen and terminate.
matrix can be used as follows:
[
speed can range from 1 to 99 and indicates how fast the numbers are moving down.
code:
#include
#include
#include
#include
// Signal handler for Ctrl-C
void handle_sigint(int sig){
endwin();
exit(0);
}
int main(int argc, char *argv[]){
if (argc !=2){
printf("Usage: %s speed
", argv[0]);
return 1;
}
int speed = atoi(argv[1]);
if (speed 1|| speed >99){
printf("Speed must be between 1 and 99.
");
return 1;
}
// Initialize curses
initscr();
cbreak();
noecho();
curs_set(0);
timeout(100- speed); // Adjust speed
srand(time(NULL)); // Seed the random number generator
// Set up signal handler for Ctrl-C
signal(SIGINT, handle_sigint);
int max_x, max_y;
getmaxyx(stdscr, max_y, max_x);
while (1){
for (int x =0; x max_x; x++){
int r = rand()%3;
char ch =(r ==0)?'0' : (r ==1)?'1' : '';
mvaddch(0, x, ch);
}
scrollok(stdscr, TRUE);
scrl(1);
refresh();
}
// End curses mode
endwin();
return 0;
}
 Using online gdb.com, please write a C code, and please SHOW

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!