Homework What to do? -Run the following C program and explore its use. #include
ID: 3651637 • Letter: H
Question
HomeworkWhat to do?
-Run the following C program and explore its use.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
srand( (time(0))) ;//ensure that each time rand(0 runs it generate a different serie
int r = 0;//variable used to store the generated number
char c;
while((int)(c) !=27) //as long as the ASCII code for the char pressed is not 27 (Esc = escape key)
{
c = getch();//press a key...any key (i.e. the Enter key)
system("cls");//clear screen so rsult appears in the same location
printf("%c ---> %d", (char)(r = rand()%127), r);//generate a number (ASCII code) between 0 and 127 and display its corresponding
//char
}//end while
system("PAUSE");
return 0;
}//end main
-Code another program utilizing the same techniques and based on the following specs.:
-declare an empty array of 26 entries of type char that would hold only those numbers (ASCII codes) that represent the characters of the alphabet a to z or A to Z
-run the random function, store whatever char that corresponds to the generated number in the array