@ melissad - What you poseted was not c call at all. fstream is from the C++ STL. Not sure if you noticed but your code will run forever or throw an exception for reading outside the bounds of the file or array. There is an error with the inner for loop.
ok Hiroshe actually my file is of numeric type.And there are almost seventeen to eighteen columns but i want to read only first two columns and find the mean of second column. You can see from the file i attached.
Well that is pretty easy to do. You need to calls two >> and one call to ignore to eat the rest of the line. The folwwing is psuedo code:
// use ifstream for file read operations
ifstream file(some data file);
// since the first read operation in a line is >> use that for the loop control
while (file >> column1)
file >> column2
file ignore rest of line
add column1 and column2 to some sort of container.
You can read here on how to ignore the rest of the line in the file.
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...