Question: Q 1 ) Write a C + + program that can read data from an input file ( provided at the bottom ) into a
QWrite a C program that can read data from an input file provided at the bottom into a
one dimensional array dont use vector and perform the following functions:
A function to check if a certain integer exists in the array if the number is present return the
index where the number is present.
A function that can modify the value of an integer when called with the index of the integer in
the array and return the new value and old value back to the user.
A function that adds a new integer to the end of the array
A function which intakes an index of an array and replaces the value with either or removes
the integer altogether.
Q A way to indicate an error, especially if there are several possible errors in code, is
through the use of exceptions. Exceptions are used to signal that an error has occurred. You can insert
code in your program that throws an exception when a particular kind of error occurs. An exception
handler allows the user to catch or handle the exception. To avoid uncaught exceptions, you write a try
block that can throw an exception and follow it with a catch block that catches the exception and
handles it Using the array code from question perform the following:
Add a try and catch blocks to the user inputs for the following functions from question :
A function that can modify the value of an integer when called with the index of
the integer in the array and return the new value and old value back to the user.
A function that adds a new integer to the end of the array input file:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
