1. Course
  2. Arrays
  3. Array of struct

Array of struct


Last updated: 8/23/2020 Difficulty: Intermediate

Create a C # program that uses an array of struct to store a car record. You will first need to create a data structure called Car with two public properties:

  • Model: string
  • AnyoFabricacion: int

Now request for example 3 cars from the user and save them in the structs array. Lastly, order the cars by their year of manufacture, the oldest first.

Input

BMW
2005
Porsche
1970
Toyota
1993

Output

Model: Porsche, Year of production: 1970
Model: Toyota, Year of production: 1993
Model: BMW, Year of production: 2005

Solution

Arrays

9 / 11

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Make a donation


Your donations support our work and contribute to the maintenance of the app.

Advertising