Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

write a program which reads integers into a linked list using pointers to structures instead of array indices. The integers must be read from an

write a program which reads integers into a linked list using pointers to structures instead of array indices. The integers must be read from an input file determined by prompting the user. Allocate an array of 50 C++ structures defined as follows:

struct entry {

int value; // the integer read in

struct entry *nextPtr; // pointer to the next structure

};

You must also declare a struct entry *firstPtr which points to the first entry in the linked list. You must declare a struct *lastPtr which points to the last entry in the linked list. You must NOT allow the lastPtr to point beyond the end of the array.After reading in the integers in the file print out (using pointers, not array indices) the integers read in the order they were read with no more than 10 entries per line. Also include a while loop that couts an error if the user does not input the right file, and another while loop that gives an error if the input file contains stuff other than 50 numbers.

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