Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myCars = [Car("Red", 1986), Car("Black", 2007), Car("Blue", 1993)]
- # and then going through the cars:
- for car in myCars:
- print("The car has the color " + car.color + " and is " + (2014 - car.year) + " years old.")
- struct Car {
- string color;
- int year;
- };
- int bilar[3] = {Car cars[0], Car cars[1], Car cars[2]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement