having trouble reading data from a file
I am trying to write a program that will look in a file that contains data such as the following:
0.0000000e+000 1.0000000e+000
9.8174770e-003 9.9518473e-001
1.9634954e-002 9.8078528e-001
2.9452431e-002 9.5694034e-001
3.9269908e-002 9.2387953e-001
and determine the number of rows of data. I seem to keep getting hung up on the while statement. Can anyone help?
------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
#include <fstream.h>
void main(void)
{
char file_in[20];
int insize=0, rows=0;
double time;
double amplitude;
FILE *input;
cout<<"Please enter the name of the file to load.\n";
cin>>file_in;
insize=strlen(file_in);
input=fopen(file_in, "r");
while(fscanf(input, "%lf %lf", &time, &litude)==2)
rows++;
cout<<"The number of rows is "<<rows
}