0% found this document useful (0 votes)
7 views

3rd Assignment of Programming Fundamentals

The assignment requires students to read integer and character values from a provided text file, storing valid integers in an array based on user input. Students must implement dynamic memory allocation for the array, handle user decisions for reading data, and design functions for file handling and array regrowth. The assignment is due on January 20, 2025, and is worth a total of 30 marks, with specific tasks outlined for implementation.

Uploaded by

mianghaffar616
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

3rd Assignment of Programming Fundamentals

The assignment requires students to read integer and character values from a provided text file, storing valid integers in an array based on user input. Students must implement dynamic memory allocation for the array, handle user decisions for reading data, and design functions for file handling and array regrowth. The assignment is due on January 20, 2025, and is worth a total of 30 marks, with specific tasks outlined for implementation.

Uploaded by

mianghaffar616
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

You might also like