Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Cant seem to get the sorting to work #includeiostream 2 # include 3 using namespace std; 4 void buildarray(int arrll,int n); 5 void print boundaries()

Cant seem to get the sorting to work
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
#includeiostream 2 # include 3 using namespace std; 4 void buildarray(int arrll,int n); 5 void print boundaries() 6 void mystringCopy(char destination[], const char source ID 7 int myStringLength(const char str[l); 8 void bubble sort(char str1[10119],int pos[10]): 9 int main() 11 I/keep track of names from input file and the position of number 12 char names from input[10119]: 13 int pos[10]: 14 buildarray(pos, 10): 15 Ifiles for input and output files to be entered by user 16 char input file[50] 17 char length file[50] 18 char alphabet file(501: 19 /Getting user, input 20 cout input file 22 cout length file; cout alphabet file; 26 file handLing 27 ifstream input stream; input stream.open(input file); /print to cout myst ringLength ( strli + i])) myStringCopy(temparr,stri[i]) mystringcopy(strili],strili 1]): myStringcopy(stri[i],temparr): temp pos[i]: pos[i] pos[i +1 pos [i +1] temp ; 100 161 rk- 103 104 in order true; else 06 07 109 Example Input File (Names.txt) Contents: Victor Eve Juliet Hector Danielle Romeo Oscar unc Ares Dannac Example Output (to Terminal and/or File): Unsorted Data (Original Input Order and Name) 0 Victor 1 Eve 2 Juliet 3 Hector 4 Danielle 5 Romeco 6 Oscar 7 June 8 Ares 9 Dannac Sorted-by-Length Data (Original Input Order and Name) 1 Eve une 8 Ares 5 Romeo 6 Oscar 0 Victor 2 Juliet 3 Hector 9 Dannac 4 Danielle #includeiostream 2 # include 3 using namespace std; 4 void buildarray(int arrll,int n); 5 void print boundaries() 6 void mystringCopy(char destination[], const char source ID 7 int myStringLength(const char str[l); 8 void bubble sort(char str1[10119],int pos[10]): 9 int main() 11 I/keep track of names from input file and the position of number 12 char names from input[10119]: 13 int pos[10]: 14 buildarray(pos, 10): 15 Ifiles for input and output files to be entered by user 16 char input file[50] 17 char length file[50] 18 char alphabet file(501: 19 /Getting user, input 20 cout input file 22 cout length file; cout alphabet file; 26 file handLing 27 ifstream input stream; input stream.open(input file); /print to cout myst ringLength ( strli + i])) myStringCopy(temparr,stri[i]) mystringcopy(strili],strili 1]): myStringcopy(stri[i],temparr): temp pos[i]: pos[i] pos[i +1 pos [i +1] temp ; 100 161 rk- 103 104 in order true; else 06 07 109 Example Input File (Names.txt) Contents: Victor Eve Juliet Hector Danielle Romeo Oscar unc Ares Dannac Example Output (to Terminal and/or File): Unsorted Data (Original Input Order and Name) 0 Victor 1 Eve 2 Juliet 3 Hector 4 Danielle 5 Romeco 6 Oscar 7 June 8 Ares 9 Dannac Sorted-by-Length Data (Original Input Order and Name) 1 Eve une 8 Ares 5 Romeo 6 Oscar 0 Victor 2 Juliet 3 Hector 9 Dannac 4 Danielle

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

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions

Question

Be optimistic and enthusiastic.

Answered: 1 week ago

Question

Has the priority order been provided by someone else?

Answered: 1 week ago

Question

Compare the current team to the ideal team.

Answered: 1 week ago

Question

Are the rules readily available?

Answered: 1 week ago