Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

It should be in C programming language. ASSIGNMENT 3-QUEUES IN C ASSIGNMENT 3-ARRAYS AND POINTERS STEP 1: REMOVE THE GLOBAL VARIABLES You need to comment

It should be in C programming language.
image text in transcribed
image text in transcribed
ASSIGNMENT 3-QUEUES IN C ASSIGNMENT 3-ARRAYS AND POINTERS STEP 1: REMOVE THE GLOBAL VARIABLES You need to comment out the global variables: int front 0: int rearl: int itemCount-0: And add the declarations into the top of the main function under the declaration for the array. int main) ( int intarray [MAX)-{ 3, 0,0, o, o, o, o, o, o, o); //Add variables here return (EXIT SUCCESS): STEP 2: ADD LOOPING INPUT Give the user integer options for each function. Ask them what they want to do. If they want to enqueue they also need to enter an integer value for input. Use integer values for making choices, ie 1- EnQueue, etc 2. 1. Make sure they have an exit option 3. This information must be passed to the Print function, see step 3 4. If they select EnQueue, they also need to provide an integer as input. 5. use a switch statement to call the correct function and make the correct call to Print) Lgsed upon the user input. 6. You have to call Print at the end of each operation. STEP 3: ADD TO THE PRINT FUNCTION Have the print function accept the user'schoice of function and print the function selected into the file before the front and rear are printed: Add information about user input here. front : 0 rear : -1 index : 0123 45 queue : 300000 You need a switch statement to print one of the following before front and rear are printed 1. For enQueue, you need the number being added to the queue User Choice: enQueue value 3 2. For deQueue, you need to print the choice and the returned/removed value: User Choice: DeQueue Returned value3 3. For size, you need to print the size User Choice: queue.size)3 4. For is empty you need to print true if its empty and false if it's not. User Choice: queue.isEmpty -true 5. For is full you need to print true if its empty and false if it's not. User Choice: queue.isFull true 6. For peek you need to print the results of the peek function: User Choice: queue. Peek 3 STEP 4: USE POINTERS INSTEAD OF GLOBAL VARIABLES Use pointers to front, rear, and itemCount instead of global variables. (see slides) Pass their addresses into ONLY the functions that need them. If the function does not use the variable/pointer, do not waste memory passing them. Use pointers to receive and access their values. See slides. Use pointer addition/subtraction to access array elements. See slides. 1. 2. 3. STEP S: WRITING OUT TO A FILE Change all output to the screen in the Print function to printing to a file. 1. Open and close the file in the Print function. 2. Make sure to append to the file when you write to it. 3. Nothing in the function Print should appear on the screen, only sent to a file. BONUS POINTS ADDING SEPARATE A FUNCTION Add a sperate function for outputting and handling user input. Printouts should be here Switch for calling functions should be here Looping portion should be in main, and calls this function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

Let fX,Y(x,y) = (9/642) (x2)(y) for 0 Answered: 1 week ago

Answered: 1 week ago