nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

C question

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 ...


Go Back   nixCraft Linux Forum > Development/Scripting > Coding in General

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-05-2006, 03:33 AM
TOP TOP is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
Rep Power: 0
TOP
Default C question

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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-08-2006, 04:00 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 578
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

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
Reply With Quote
  #3 (permalink)  
Old 03-10-2006, 03:13 AM
TOP TOP is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
Rep Power: 0
TOP
Default

lol Yes,just have no idea with that C porg
Reply With Quote
  #4 (permalink)  
Old 03-10-2006, 11:08 PM
sweta's Avatar
Contributors
User
 
Join Date: Feb 2005
Location: New Delhi
My distro: Suse, RHEL, Vista
Posts: 152
Rep Power: 4
sweta will become famous soon enough
Default

lol
__________________
Friends - v-nessa - missyAdmin
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT +5.5. The time now is 06:06 AM.


Powered by vBulletin® Version 3.7.3 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36