Programming Fundamentals
Assignment 3
Total Marks: 30
(Dynamic Memory Allocation, Pointers, Functions, Filing, Char Array)
DEADLINE: 20 January 2025
Submission: On portal (.cpp file)
Problem: Read a file data.txt provided with manual. This file contains integer and character
values. Read all the values form text file in an array till a character value comes up which means
the valid inputs to be stored in the array will be an integer value. The reading of data from text
file should be done one by one depending upon user’s choice. You need to ask user whether they
want to read a value from this file and based upon a Boolean decision you read one value from
this file. User should be asking for their decision after every reading. The reading will also
terminate on the reading of an invalid input from file.
Sample Console:
Press ‘Y’ to read data from the file and press ‘N’ to terminate reading.
Data Read Successfully
Displaying Array:
1000
Press ‘Y’ to read data from the file and press ‘N’ to terminate reading.
Data Read Successfully
Displaying Array:
1000 5000
Press ‘Y’ to read data from the file and press ‘N’ to terminate reading.
Reading Terminated.
Final Array: 1000 5000
Sample Data File:
1000
5000
4200
8130
4678
9800
Task a – Decide condition for an invalid input from file.
Task b – Design solution for user’s decision after every reading.
If your user’s decision is to read the data, read the value and store it in an array. If user decide
to read another value, you should regrow the array and put the newly read value to new index.
Task – c Decide what possible functions you can you make regarding Filing. (Max Points: 5,
Minimum:0)
Task – d Design the regrowth of an array. Make any function you find necessary.
Task – e Design an efficient main with proper calls, actual parameters and variables required.
Rubric:
Implementation Points
Task a 2.5Pts
Task b 2.5Pts
Task c 5Pts
Task d 15Pts
Task e 5Pts
Total 30
Zero Marks in Case of Plagiarism.