![]() |
array issue
2 questions first did the main daniweb site get hacked or something...2nd can someone take a look at my code and see what I am doing wrong...can't seem to pinpoint it
Not sure what I am doing wrong but have an issue with a program...i am to input a file name that i have in my project and it is not doing it right... This is what my program should look like for each textfile... Sample Output 1 Enter the file to read in: data1.txt The numbers in the array are: 45.3 57.4 23.6 34.2 234.6 34.9 54.8 934.9 8432.5 9809.3 539.7 43.9 12.0 The numbers in the array are: 12.0 23.6 34.2 34.9 43.9 45.3 54.8 57.4 234.6 539.7 934.9 8432.5 9809.3 The average of the numbers is 1558.2 The median of the numbers is 54.8 Press any key to continue What I am getting is... Enter the file to read in: data1.txt The numbers in the array are: The average of the numbers is 45 The median of the numbers is 0 Press any key to continue... Not sure what I am doing wrong any help would mean alot :
|
Re: array issue
Here's something that does pretty much the same thing. I wrote it earlier this semester for my principle of programming languages class:
:
#include <iostream> |
Re: array issue
In your Fill_Array function, you don't set the number_used variable to the number of items found.
In your print_array function: :
void Print_Array(int Size[], int count)The Calc_Average and Calc_Median functions need to be passed the number of items in the array, rather than using MAX_SIZE Also, your array is of type int, and the input has floating point numbers, you should look into using type double. |
Re: array issue
Guess no one has answered his first question, the ALMIGHTY Dannyo329 has answered:
I Do Not Think So.( I was just on it , not sure at the time when you posted your questions though.) |
| All times are GMT -5. The time now is 12:37 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC