Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To make your program interactive, you need a function, getInput, for parsing the user input. The program should ask the user to enter two (possibly

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

To make your program interactive, you need a function, getInput, for parsing the user input. The program should ask the user to enter two (possibly noisy) lines of integers and parse them by calling get Input twice. The first line will contain the integers that the program will push to the list. The second line will contain the integers that decide from which side of the list the program will pull the integers. To avoid overflow, get Input will only accept max Input digits, where maxinput =5 BLOCKSIZE. For example, if BLOCKSIZE =1, and the first line of the user input is On3 plu8 tw0 3 qu4l th833 the program will push a 0 to the tail-side stack, a 3 to the head-side stack, an 8 and another 0 to the tail-side stack, and another 3 to the heas-side stack. All characters after the second 3 will be discarded. Define maxinput outside main, e.g. just after the headers, so that it can be accessed by all functions. - Declare getinput as int getinput (char *s); 1 where s is a string and the return value is the minimum between the number of digits in the input and maxInput. The function should use s to buffer the digits as suggested in Algorithm 1 . - Complete main given in Listing 5 so that your program behaves as in the examples given below. int main() \{ int counter - 0; struct list myList; initialiselist (\&myList, \&counter); printlist (smyList, \&counter); char sPush []; char sPull []; int lenPush = getinput (); int lenPull = getinput (); int i=0; int j=0; while ((i+j)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions