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

  1. BMW
  2. 2005
  3. Porsche
  4. 1970
  5. Toyota
  6. 1993

Output

  1. Model: Porsche, Year of production: 1970
  2. Model: Toyota, Year of production: 1993
  3. 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


CookieOwn and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.