QUOTE(no2pencil @ 14 Dec, 2007 - 01:16 PM)

1st

2ndly, I see two
void main() functions. Can't have two functions of the same name, let alone two main functions!
Sorry. I hope this makes more sense.
Thanks
CODE
class carsandvans // class specification
{
private:
int carsOnHand; // cars on hand
int vansOnHand; // vans on hand
public:
void displayData() // display cars and vans
{
cout << "\n Cars = " << carsOnHand;
cout << "\n Vans = " << vansOnHand;
}
void SoldOnecar() // record sale of one car
{
--carsOnHand;
--vansOnHand;
}
void initData() // set initial quantities
{
cout << "\n Enter cars on hand: ";
cin >> carsOnHand;
cout << " Enter vans on hand: ";
cin >> vansOnHand;
}
}; // end of carsandvans class
/////////////////////////////////////////////////////////////
void main()
{
char choice = 'x'; // user's letter choice
clrscr();
carsandvans shop1; // create car shop objects
carsandvans shop2;
carsandvans shop3;
// set initial data
cout << "\nInitialize data for shop 1";
shop1.initData();
cout << "\nInitialize data for shop 2";
shop2.initData();
cout << "\nInitialize data for shop 3";
shop3.initData();
while(choice != 'q') // loop until user enters 'q'
{
cout << "\nEnter shop number, or q to quit: ";
cin >> choice;
switch(choice)
{
case '1':
cout << "Selling a car at shop 1";
shop1.SoldOnecar();
break;
case '2':
cout << "Selling a car at shop 2";
shop2.SoldOnecar();
break;
case '3':
cout << "Selling a van at shop 3";
shop3.SoldOnecar();
break;
} // end switch
} // end while
// display current data
cout << "\nSupplies on hand at shop 1";
shop1.displayData();
cout << "\nSupplies on hand at shop 2";
shop2.displayData();
cout << "\nSupplies on hand at shop 3";
shop3.displayData();
getch();
}
CODE
void displayData() // display cars and vans
{
cout << "\n Cars = " << carsOnHand;
cout << "\n Vans = " << vansOnHand;
}
void SoldOnecar() // record sale of one car
{
--carsOnHand;
--vansOnHand;
}
void initData() // set initial quantities
{
cout << "\n Enter cars on hand: ";
cin >> carsOnHand;
cout << " Enter vans on hand: ";
cin >> vansOnHand;
}
}; // end of carsandvans class
/////////////////////////////////////////////////////////////
void main()
{
char choice = 'x'; // user's letter choice
clrscr();
carsandvans shop1; // create car shop objects
carsandvans shop2;
carsandvans shop3;
// set initial data
cout << "\nInitialize data for shop 1";
shop1.initData();
cout << "\nInitialize data for shop 2";
shop2.initData();
cout << "\nInitialize data for shop 3";
shop3.initData();
while(choice != 'q') // loop until user enters 'q'
{
cout << "\nEnter shop number, or q to quit: ";
cin >> choice;
switch(choice)
{
case '1':
cout << "Selling a car at shop 1";
shop1.SoldOnecar();
break;
case '2':
cout << "Selling a car at shop 2";
shop2.SoldOnecar();
break;
case '3':
cout << "Selling a van at shop 3";
shop3.SoldOnecar();
break;
} // end switch
} // end while
// display current data
cout << "\nSupplies on hand at shop 1";
shop1.displayData();
cout << "\nSupplies on hand at shop 2";
shop2.displayData();
cout << "\nSupplies on hand at shop 3";
shop3.displayData();
getch();
}
CODE
void initData() // set initial quantities
{
cout << "\n Enter cars on hand: ";
cin >> carsOnHand;
cout << " Enter vans on hand: ";
cin >> vansOnHand;
}
}; // end of carsandvans class
/////////////////////////////////////////////////////////////
void main()
{
char choice = 'x'; // user's letter choice
clrscr();
carsandvans shop1; // create car shop objects
carsandvans shop2;
carsandvans shop3;
// set initial data
cout << "\nInitialize data for shop 1";
shop1.initData();
cout << "\nInitialize data for shop 2";
shop2.initData();
cout << "\nInitialize data for shop 3";
shop3.initData();
while(choice != 'q') // loop until user enters 'q'
{
cout << "\nEnter shop number, or q to quit: ";
cin >> choice;
switch(choice)
{
case '1':
cout << "Selling a car at shop 1";
shop1.SoldOnecar();
break;
case '2':
cout << "Selling a car at shop 2";
shop2.SoldOnecar();
break;
case '3':
cout << "Selling a van at shop 3";
shop3.SoldOnecar();
break;
} // end switch
} // end while
// display current data
cout << "\nSupplies on hand at shop 1";
shop1.displayData();
cout << "\nSupplies on hand at shop 2";
shop2.displayData();
cout << "\nSupplies on hand at shop 3";
shop3.displayData();
getch();
}
CODE
void SoldOnecar() // record sale of one car
{
--carsOnHand;
--vansOnHand;
}
void initData() // set initial quantities
{
cout << "\n Enter cars on hand: ";
cin >> carsOnHand;
cout << " Enter vans on hand: ";
cin >> vansOnHand;
}
}; // end of carsandvans class
/////////////////////////////////////////////////////////////
void main()
{
char choice = 'x'; // user's letter choice
clrscr();
carsandvans shop1; // create car shop objects
carsandvans shop2;
carsandvans shop3;
// set initial data
cout << "\nInitialize data for shop 1";
shop1.initData();
cout << "\nInitialize data for shop 2";
shop2.initData();
cout << "\nInitialize data for shop 3";
shop3.initData();
while(choice != 'q') // loop until user enters 'q'
{
cout << "\nEnter shop number, or q to quit: ";
cin >> choice;
switch(choice)
{
case '1':
cout << "Selling a car at shop 1";
shop1.SoldOnecar();
break;
case '2':
cout << "Selling a car at shop 2";
shop2.SoldOnecar();
break;
case '3':
cout << "Selling a van at shop 3";
shop3.SoldOnecar();
break;
} // end switch
} // end while
// display current data
cout << "\nSupplies on hand at shop 1";
shop1.displayData();
cout << "\nSupplies on hand at shop 2";
shop2.displayData();
cout << "\nSupplies on hand at shop 3";
shop3.displayData();
getch();
}
CODE
int carsOnHand; // cars on hand
int vansOnHand; // vans on hand
public:
void displayData() // display cars and vans
{
cout << "\n Cars = " << carsOnHand;
cout << "\n Vans = " << vansOnHand;
}
void SoldOnecar() // record sale of one car
{
--carsOnHand;
--vansOnHand;
}
void initData() // set initial quantities
{
cout << "\n Enter cars on hand: ";
cin >> carsOnHand;
cout << " Enter vans on hand: ";
cin >> vansOnHand;
}
}; // end of carsandvans class
/////////////////////////////////////////////////////////////
void main()
{
char choice = 'x'; // user's letter choice
clrscr();
carsandvans shop1; // create car shop objects
carsandvans shop2;
carsandvans shop3;
// set initial data
cout << "\nInitialize data for shop 1";
shop1.initData();
cout << "\nInitialize data for shop 2";
shop2.initData();
cout << "\nInitialize data for shop 3";
shop3.initData();
while(choice != 'q') // loop until user enters 'q'
{
cout << "\nEnter shop number, or q to quit: ";
cin >> choice;
switch(choice)
{
case '1':
cout << "Selling a car at shop 1";
shop1.SoldOnecar();
break;
case '2':
cout << "Selling a car at shop 2";
shop2.SoldOnecar();
break;
case '3':
cout << "Selling a van at shop 3";
shop3.SoldOnecar();
break;
} // end switch
} // end while
// display current data
cout << "\nSupplies on hand at shop 1";
shop1.displayData();
cout << "\nSupplies on hand at shop 2";
shop2.displayData();
cout << "\nSupplies on hand at shop 3";
shop3.displayData();
getch();
}
CODE
int vansOnHand; // vans on hand
public:
void displayData() // display cars and vans
{
cout << "\n Cars = " << carsOnHand;
cout << "\n Vans = " << vansOnHand;
}
void SoldOnecar() // record sale of one car
{
--carsOnHand;
--vansOnHand;
}
void initData() // set initial quantities
{
cout << "\n Enter cars on hand: ";
cin >> carsOnHand;
cout << " Enter vans on hand: ";
cin >> vansOnHand;
}
}; // end of carsandvans class
/////////////////////////////////////////////////////////////
void main()
{
char choice = 'x'; // user's letter choice
clrscr();
carsandvans shop1; // create car shop objects
carsandvans shop2;
carsandvans shop3;
// set initial data
cout << "\nInitialize data for shop 1";
shop1.initData();
cout << "\nInitialize data for shop 2";
shop2.initData();
cout << "\nInitialize data for shop 3";
shop3.initData();
while(choice != 'q') // loop until user enters 'q'
{
cout << "\nEnter shop number, or q to quit: ";
cin >> choice;
switch(choice)
{
case '1':
cout << "Selling a car at shop 1";
shop1.SoldOnecar();
break;
case '2':
cout << "Selling a car at shop 2";
shop2.SoldOnecar();
break;
case '3':
cout << "Selling a van at shop 3";
shop3.SoldOnecar();
break;
} // end switch
} // end while
// display current data
cout << "\nSupplies on hand at shop 1";
shop1.displayData();
cout << "\nSupplies on hand at shop 2";
shop2.displayData();
cout << "\nSupplies on hand at shop 3";
shop3.displayData();
getch();
}
CODE
/////////////////////////////////////////////////////////////
void main()
{
char choice = 'x'; // user's letter choice
clrscr();
carsandvans shop1; // create car shop objects
carsandvans shop2;
carsandvans shop3;
// set initial data
cout << "\nInitialize data for shop 1";
shop1.initData();
cout << "\nInitialize data for shop 2";
shop2.initData();
cout << "\nInitialize data for shop 3";
shop3.initData();
while(choice != 'q') // loop until user enters 'q'
{
cout << "\nEnter shop number, or q to quit: ";
cin >> choice;
switch(choice)
{
case '1':
cout << "Selling a car at shop 1";
shop1.SoldOnecar();
break;
case '2':
cout << "Selling a car at shop 2";
shop2.SoldOnecar();
break;
case '3':
cout << "Selling a van at shop 3";
shop3.SoldOnecar();
break;
} // end switch
} // end while
// display current data
cout << "\nSupplies on hand at shop 1";
shop1.displayData();
cout << "\nSupplies on hand at shop 2";
shop2.displayData();
cout << "\nSupplies on hand at shop 3";
shop3.displayData();
getch();
}