Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I I finish the program based on the pseudocode that uploads a test file that has random characters on it, loads this into

How do I I finish the program based on the pseudocode that uploads a test file that has random characters on it, loads this into an array, reorders the array based upon ASCII value order and prints the original order and new order to console output

// -- Libraries & Directives -- #include // Needed for normal cin & cout #include // Needed to read or write files on disk using namespace std; // PROGRAM CharacterSorter int main() { // -- Declare Variables -- // An input stream object for the text file data // An oversized array for the text characters // Keep track of number of characters // -- Main Program -- // Introduce Program to user cout << " --- Character Sorter --- " << endl; cout << " Loads a text file and then sorts " << endl; cout << " sorts its characters by ASCII value. " << endl << endl; // Open text file as an input stream // Check the file stream if ( ) { // Provide user warning cout << "Warning..."; // end program with error ; } // FOR each element in the array for (int i=0; i< ; i++) { // load character from file stream into array element ThatFile >> ; // Print array element to console cout << ; } cout << endl; // Sort array data using a common sorting method // Use Bubblesort // FOR j from 0 to for (int j = 0; ; j++) { // Last j elements are already in place so // FOR k from for (int k = 0; ; k++) { // If element is greater than the next if ( ) { // Switch their positions char temp = ; ; ; } // ENDIF } // ENDFOR } // ENDFOR // Print sorted array // For each used element in the array (from 0 to n) for (int i=0; ; i++) { // Print array element to console cout << ; } // ENDFOR } // ENDPROGRAM

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

=+a. Do you agree or disagree with that statement? Why?

Answered: 1 week ago