This is my input assigned:
// ID Name Address St Zip Majr Minr Rk QCA AltQCA Crd Hrs
135792468 Wayne,John Duke 101 Hollywood Way CA 40815 CS MATH 10 3.2667 4.0000 49 15
this is my code thus far:
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
#include <iostream>
#include <cctype>
using namespace std;
struct Program
{
char Number, Name;
char Code;
char Major, Minor;
int Rank;
char Address;
};
int i=1,q=0, y=0;
char t = '\t';
Program ID[9],Student[20],Street[25],Home[2],Zip[5],First[4],Second[4],Status[2];
//function prototypes
void readID(ifstream& In, ofstream& Out, int q);
void readName(ifstream& In, ofstream& Out, int q);
void readRank(ifstream& In, ofstream& Out, int q);
void readMinor(ifstream& In, ofstream& Out, int q);
void readMajor(ifstream& In, ofstream& Out, int q);
void readState(ifstream& In, ofstream& Out, int q);
void readZip(ifstream& In, ofstream& Out, int q);
void readAddress(ifstream& In, ofstream& Out, int q);
void main()
{ double QCA, AltQCA;
int QualCred, HrsAtt;
ifstream In("students1.txt");
ifstream InData("courses1.txt");
ofstream Out("qca1.txt");
Out<<fixed<<showpoint;
Out<<"QCA Calculation"<<endl;
Out<<"__________________________________________________________"<<endl;
Out<<"ID Number Name Major Minor Rank"<<endl;
In.ignore(255,'\n');
readID(In,Out,q);
readName(In,Out,q);
readMajor(In,Out,q);
In>>QCA>>AltQCA;
In>>QualCred>>HrsAtt;
In.close();
InData.close();
Out.close();
}
//functions to read student.dat
void readID(ifstream& In, ofstream& Out, int q){
In.get(ID[q].Number);
//reading the ID Number of the student
for(i=0;i<9;i++)
{
Out<<ID[q].Number;
In.get(ID[q].Number);
}
Out<<' ';
}
void readName(ifstream& In, ofstream& Out, int q){
In.get(Student[q].Name);
for(i=0;i<20;i++)
{
Out<<Student[q].Name;
In.get(Student[q].Name);
}
Out<<' ';
}
void readMajor(ifstream& In, ofstream& Out, int q){
In.get(First[q].Major);
for(i=0;i<5;i++)
{
Out<<First[q].Major;
In.get(First[q].Major);
}
}
And my output...
QCA Calculation
__________________________________________________________
ID Number Name Major Minor Rank
135792468 Wayne,John Duke 101 ollyw
so my question is, how do i, when bringing in the input, "skip over" the address, state, and zip code to read and output the major, minor, and rank? Also I need to make sure the remaining information, QCA AltQCA Crd Hrs, are read and stored for future use. Any help is appreciated, thank you!