Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to write a program that takes input from a file that has characters. The file that I mentioned has a single character on

I need to write a program that takes input from a file that has characters. The file that I mentioned has a single character on each of its lines. The purpose of this program is to read each character from the file, and then store each char that it read into a char array. When the whole file is done being read, then we output the array to a new file (called output.txt) that modifies all the characters to upper case and strips all the whitespaces including new lines. Also make sure to use file error checking when you perform the file operations.

I am attaching some pseudo code for this exercise.image text in transcribed

Algorithm/Pseudo-code for Exercise 1 1. ifstream ifs; 2. char iarray1000]; 3. open the input file and check for error, i.e. ifs.open("LabInput3-1.txt'"); if (ifs.fail0) // file open failed. Probably the file does not exist, or // the file is not in the correct location. // To find out where the correction location is, you can // create an output file and open it and check where the // output file is. That is the place where input file should be. Print some message to indicate the error. exit( cstdlib? 1); // include>iarray[count++]) // empty body // This code fragment reads the integers in the file ifs to the integer // array iarray Count is the number of integers read. 5. Convert each character in jarrayll to be uppercase, using toupper) 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

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions