C++ Classes Assignment Help



I need help beginning this program, I am in intro to c++ course. I need help with how to begin the program. I have done some thing already. The program is:

- define class cust(I already did this part)
- create an array of cust (size 10)to hole the data of the class.
- read the date from a file(everything from the class)
- call a function print cust(this function will print all the data in tabular format)....first, last, state, sales history(0,1,2), units

Here is the code:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

class cust{
public:
string first;
string last;
string state;
double arr[3]; //Sales history for three years
int units;
int total;
} ;

int main()
{
cust customer[10];
int i;

for(int i=0;i<10;i++)
cust customer[i];

ifstream infile;
infile.open("data.txt");

getline(infile,customer[i].first);
getline(infile, customer[i].last);
getline(infile, customer[i].state);
infile>>cust.units[]



}

void printcust(int a[], int m, string f, string l, string s, double ar[], int u){

int i;

cout<<"First"<<"\t\tLast"<<"\t\tState"<<"\t\tSales History"
<<"\t\t\tUnits"<<endl<<endl;

for(int i=0;i<m;i++)
cout<<f<<"\t\t"l<<"\t\t"s;



}
Last edited on
1) Please use code tags when posting code, to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/

2) Can you be more specific about what it is you're having trouble understanding?
Topic archived. No new replies allowed.