•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 455,979 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,786 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 297 | Replies: 1
![]() |
•
•
Join Date: Nov 2007
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
Dear all;
I want to sort and class the random data by using C programming. The below are example of th data:
Diameter Velocity
0.05 1.0
0.05 1.2
0.15 2.2
0.05 1.2
0.25 3.1
0.35 4.3
0.25 3.1
0.35 4.3
0.45 5.7
0.15 2.2
0.15 2.0
I want to get the maximum number of occurence of the velocity for a given size. If you look from above data so the result is:
0.05 = 1.2 (2 times)
0.15 = 2.2 (2 times)
etc...
Could you help me all? how to class the above data ? and also how to read the data in better way because the header is character.
Thanks for your help
Cheers
Marzuki
I want to sort and class the random data by using C programming. The below are example of th data:
Diameter Velocity
0.05 1.0
0.05 1.2
0.15 2.2
0.05 1.2
0.25 3.1
0.35 4.3
0.25 3.1
0.35 4.3
0.45 5.7
0.15 2.2
0.15 2.0
I want to get the maximum number of occurence of the velocity for a given size. If you look from above data so the result is:
0.05 = 1.2 (2 times)
0.15 = 2.2 (2 times)
etc...
Could you help me all? how to class the above data ? and also how to read the data in better way because the header is character.
Thanks for your help
Cheers
Marzuki
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,539
Reputation:
Rep Power: 40
Solved Threads: 972
use a linked list of structures. Read a value from the file, search the list to see if its already in the list. If found just increment the count. Otherwise if not found then add a new node and initialize the count to 1. Note: for value in the below structure multiply the float read from the file by 100 to get an integer. Don't use floats in the structure because comparisons may be inexact.
>>and also how to read the data in better way because the header is character.
better than what? you didn't post any code.
struct data
{
int value;
int count;
};>>and also how to read the data in better way because the header is character.
better than what? you didn't post any code.
Last edited by Ancient Dragon : Nov 28th, 2007 at 9:53 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Do I need to take Data Structures? (C++)
- Collapsible table sorting problem (JavaScript / DHTML / AJAX)
- Sorting string data (C++)
- Sorting in Python (Python)
- Reading an input file as a class memeber function (C++)
- Please I need help formatting an output file and sorting the names! (C++)
- Sorting a selection (Visual Basic 4 / 5 / 6)
- Need Help with ArrayList sorting (Java)
Other Threads in the C Forum
- Previous Thread: Parsing a csv file in C
- Next Thread: Doubly Linked List Problem - Help!



Linear Mode