I have to write a program that takes a person's name as arguement and prints out all of the information about said person.
I wrote a code to do this but it's not working with the name passed as arguement and I can't really understand why. This is the code:
struct car {
...
}
struct person {
...
Car car
}
void InfoPerson(Car car, Person person) // i think this is where i'm doing something wrong)
{
...
}
int main {
Car namecar:
...
Person guy1;
...
Person guy2;
...
string person = argv[1]
InfoPerson(namecar, person)
I know that there's surely something wrong with namecar as it always prints out the same thing even if i have the person has a different car, but i don't know how else to define InfoPerson.
I also don't understand why I cannot use person in InfoPerson.
http://sscce.org/
Rather than random single lines, make a short example.
Each class only needs 1 variable and 1 method to demonstrate the issue.
Then a few lines in main to finish the job.
The end result is something which either clearly demonstrates the issue, or the very exercise of doing it makes you realise what your mistake was.
Either way, it's a win for everyone.