Struct

I have written a program for a Car salesman, I am wondering how do I add a new record to the program and also when i want to display a record of all the cars, it will show the new car added to the record.

Assuming you've defined a "salesman" class and a "Car" structure, you'd do something like this (assuming all methods are defined):
1
2
3
4
5
6
7
int main(void)
{
//stuff
salesman bob;
bob.add_Car(*Car info goes here*);
bob.display_Cars(*probably no arguments passed*);
}


The salesman class should probably contain a private array of Cars to store the record of sales, and display_Cars() accesses this private array and displays it.
Topic archived. No new replies allowed.