In this homework you have to sort all the people given in “hw4_disordered_people.txt”. You will get the sort column from the user and write the ordered people in “orderedFile.txt”.
Standart column order is as shown (items aren’t sorted):
ID NAME SIR NAME MAIL 4564765 Andria MALLE abc@gmail.com 246574 Andrea DENNIS abcc@gmail.com 454 Angeline TOWNSEND townsend@gmail.com 3245
….. Ania DEAR defghjklmnd@gmail.com The column selected by the user will be placed on the first column and the order will be made according to it. Sample:
Give a Sort Metric (I = ID N= NAME S= SIR NAME M=MAIL): M Output file will be as shown (sorted by mail): NAME SIR NAME (this line must be added) MAIL ID abc@gmail.com 4564765 Andria MALLE abcc@gmail.com 246574 Andrea DENNIS defghjklmnd@gmail.com 3245 Ania DEAR townsend@gmail.com
….. 454 Angeline TOWNSEND
Give a Sort Metric (I = ID N= NAME S= SIR NAME M=MAIL): N
Output file will be as shown (sorted by name): NAME ID SIR NAME MAIL (this line must be added) Andrea 246574 DENNIS abcc@gmail.com Andria 4564765 MALLE abc@gmail.com Ania 3245 DEAR defghjklmnd@gmail.com Angeline
…… 454 TOWNSEND townsend@gmail.com
The order of ascii table will be used in the sorting. Detailed in the next page.
Tips:
• If tou need you can use itoa function to convert integer to char array:
http://www.cplusplus.com/reference/cstdlib/itoa/
• There is no restriction to use of c libraries.
Rules:
• Console inputs must be accept upper case character “N, M,I,S”. Can be accept lower case character “n, m, i, s”
• Output file name: orderedFile.txt
• Input file name is: hw4_disordered_people.txt
• Upload your files only in a .zip file on Moodle. The zip name should be in the same in the form of: number_name_surname (g.e. 181041001_abdullahsalih_bayraktar.zip).
• Zip file can contain source files with “c” and or “h” extension. No other files excluding hw4_disordered_people.txt (look at next rule).