Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Enter a string through the keyboard (For end use Ctrl+Z). The string should be copied into an output file text.txt. Then open an input file

Enter a string through the keyboard (For end use Ctrl+Z). The string should be copied into an output file text.txt. Then open an input file stream to read from the file text.txt. Each character that is an uppercase should be stored into an array text2[]. For checking use the function (isupper(char)). Print the array. Sum the ASCII codes of each element in the array and calculate the total ASCII code. Find the average ASCII code of the array. Create two sub-arrays:

The first one should contain all the uppercase letters whose ASCII code is less than the average ASCII code of the array,

The second one should contain all the uppercase letters whose ASCII code is greater than the average ASCII code of the array.

Put the last character of each array to be '\0'. Print the two arrays. If the number of elements in the first array is divisible by 2, sort the array with Buuble sort, else sort it with Quicksort. Similar, if the number of elements in the second array is divisible by 2, sort the array with Insertion sort, else sort it with Selection sort. Print the sorted arrays.

In C++

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

Guidelines For Auditing Process Safety Management Systems

Authors: CCPS (Center For Chemical Process Safety)

2nd Edition

0470282355, 978-0470282359

More Books

Students also viewed these Accounting questions

Question

hy is a packet - filtering firewall a stateless device?

Answered: 1 week ago