| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 !!!! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > help!!read a data file into an array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|