This is a discussion on C question within the Coding in General forums, part of the Development/Scripting category; In this program, you try to simulate some concepts in C++. There are several steps. The first step is to ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
In this program, you try to simulate some concepts in C++. There are
several steps. The first step is to implement the quicksort function, which takes an abstract array (in the sense that the program does not know what the data type is for the elements in the array before running time), the size of the array, and the function to do the comparisons between the elements in the array in the sorting. In addition to these parameters, quicksort may need some other parameters. The general idea is that the abstract array may be implemented as a dynamic twodimension array, while the comparison function can be passed into quicksort function using a function pointer. You might want to review the class notes and text book (Page 120) on dynamic two-dimension arrays and function pointers. You can also use $man qsort to take a look at the library function called qsort. The second step is to create a function stringcmp for doing the comparisons between ASCII strings and a function intcmp for doing the comparisons between integers. The third step is to read data from an input file for students. The format of each student record is: Student’s First Name:Student’s Last Name:Years in U of L:GPA Each line can contain multiple records (separated by *) for several students. For instance, the following is a sample of the input file. John:Smith:3:3.24*William:Smith:4:3.8*Bill:Clinton :3:2.34 Jeremy:Hill:4:3.50*Amy:Wood:4:3.90 Your program has a loop, with each iteration prompting a user to select which column to be sorted. The user can choose to sort either on the students’ first names, students’ last names, years in U of L or GPAs. The result is displayed on the screen. Since GPAs could be floating-point numbers, you also need to create a comparison function (called floatcmp) for comparing two such numbers. Assume that the user always wants to see the elements in a column to be sorted in the ascending order. You can assume that there is no error in the input file and there is no error in the command-line parameters. The format for executing your executable is $sorting indata |
| Sponsored Links | ||
|
|
|
||||
|
LOL some one posted his/her homework here
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| phpmyadmin question | paul555 | Databases servers | 2 | 07-13-2007 08:27 AM |
| Squid Question | asterisk | Linux software | 2 | 05-17-2007 04:52 PM |
| C question | TOP | Coding in General | 1 | 07-08-2006 12:14 AM |
| question | TOPHUMAN | Shell scripting | 1 | 02-06-2006 01:25 PM |
| Redirecting question | sonaikar | Linux software | 1 | 06-25-2005 12:18 AM |