C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 29th, 2004, 11:13 PM
shoosea shoosea is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 shoosea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
help!!read a data file into an array

hey guy:

I am trying to read 50 integers from a data files into an array,
The files look like this

-12 3 -12 4 1 1 -12 1 -1 1 2 3 4 2 3 -12

the output should be

Value Count
4 2
3 3
2 2
1 4
-1 1
-12 4
use function to
1.read the values from the data file into an array
2.sort the calues in the array(largest to smallest)
3.Count and display the number of occurrences of each distinct element

I got an error on the function 1:

void getArrayValues (int value[50], int num)
{
ifstream inStream;
inStream.open("files.dat");

inStream >> num;

for(int i=0; i<num; i++)
{
inStream>>value[i];
{
for (int j=0; j<value[i]; j++)
}
inStream.close();
}
}

Please help!!!!
and I have no idea how to do the sorting things ..
Can anyone give me some idea?
thank you !!!!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > help!!read a data file into an array


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT