Read input from a file and loop it

I really need help with this code :( I am really stuck. The part i am stuck in is where I have to make it read the input file and loop it so that it reads each line. if its a m (male) or if its a f (female) depending on what the person picks and then for it to calculate the average if which ever they pick

Please help me .. thank you

//include section
#include <iostream>
#include <conio.h> //for use with getch
#include <string> //string data types
#include <fstream> // in and out data

using namespace std;

int main ()
{

string name,majorname,coursename;
ifstream inData;
ofstream outData;
double gpa;
double average;
char gender;


inData.open("input.txt");
outData.open("outData.txt");

//stuff writting out to screen / displayed
cout<<"Hello there, What is your name?"<< endl;
getline(cin,name);
cout<<"Welcome "<<name<<endl;
cout<<"Please enter your degree your majoring in."<<endl;
getline(cin,majorname);
cout<<"What the name of the course your taking for your major "<<majorname<<" ?"<<endl;
getline(cin,coursename);
cout<<"What is your gender? Enter m for male or f for female"<<endl;
cin>>gender;


//Stuff written out to txt file
outData<<"Person's name is " <<name<<". And there degree major is "<<majorname<<"."
" The class course name for there degree major is "<<coursename<< "."<<endl;

while (gender == m)
{

}
if (gender == 'm') // if gender is male
inData >> gender >> gpa;

else if (gender == 'f') // if gender is female
inData >> gender >> gpa;


getch ();
return 0;
}
[2098 byte] By [lifeis2evil] at [2007-11-20 11:34:33]
# 1 Re: Read input from a file and loop it
Please dont post in multiple forums. You have posted the same question in the VC++ forum. There you have also got some comments, although this post belongs here in the non-visual c++ forum.

Can some moderators please merge these threads?

Laitinen
laitinen at 2007-11-9 1:25:53 >