View Single Post
Old 11-20-2005, 02:21 PM   #15 (permalink)
subodhgupta1
Registered User
 
Join Date: Sep 2005
Posts: 24
subodhgupta1 is on a distinguished road
Post New Problem please help

Write a C++ program that loads a 101-by-101 array of integers from a data file (provided) . Invoke the “load-array” function to load the array (provided —see below) . Your program then should make use of a function that totals the elements on the middle row and center column of the array, and then returns that sum to the caller. Your program should display the result.

Provide your entire solution.
Code:
#define FILENAME “C:\\data.dat” 
bool Load Array (mt array[] [101]) 
ifstream input_file; 
input file.open (FILENAME) 
if ( input_file) 
cout << “Cannot Open Input Data File.” << endi; 
return false; 
for (mt row = 0; row < 101; ++row) 
for (mt ccl = 0; ccl < 101; ++col) 
input_file >> array[row] [col] 
input file.close () 
return true;
Data of data.dat file:
72
-9
-99
// edit removed, even I know what 10.000 random numbers looks like

Last edited by redhead; 11-20-2005 at 02:45 PM. Reason: added [code] tags, and removed emensly large ammount of input-data
subodhgupta1 is offline   Reply With Quote