Here is the code:
Code:
#include<iostream.h>
#include<conio.h>
#include<string.h>
class Order
{
Order yearEndTotal(Order summary, Order oneOrder);
private:
char customerName[20];
int orderQuantity;
public:
Order();
setValues();
displayValues();
};
Order::Order()
{
strcpy(customerName,name);
orderQuantity=0;
};
void setValues()
{
cout<<"Enter customer name ";
cin>>name;
cout<<"Enter quantity ordered: ";
cin>>orderQuantity;
};
void Order::displayValues()
{
cout<<customerName<<" ordered "<<orderQuantity<<"items."<<endl;
};
Order yearEndTotal(Order summary, Order oneOrder)
{
summary.orderQuantity = oneOrder.orderQuantity;
return(summary);
};
void main()
{
const int ORDERS = 10;
Order anOrder[ORDERS];
Order summary;
int x;
for(x=0; x<ORDERS; ++x);
anOrder[x].setValues();
for(x = 0; x< ORDERS; ++x)
{
summary = yearEndTotal(summary,anOrder[x]);
};
summary.displayValues();
getch();
};
All I have to do is debug and I am not able to fix the seven erros that I am getting. Can anyone help?