Вывод значений элементов массива на экран - C#
Формулировка задачи:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication12 { class Program { enum FlightType { flights, } struct airplanesProperties { public int number; public string city; public string airline; public int terminal; } static void Main(string[] args) { airplanesProperties[] flight1 = new airplanesProperties[4]; flight1[0] = new airplanesProperties { number = 1, city = "Kiev", airline = "MAU", terminal = 1 }; flight1[1] = new airplanesProperties { number = 2, city = "Odessa", airline = "MAU", terminal = 2 }; flight1[2] = new airplanesProperties { number = 3, city = "Kharkiv", airline = "MAU", terminal = 3 }; flight1[3] = new airplanesProperties { number = 4, city = "Odessa", airline = "MAU", terminal = 4 }; for (int i = 0; i < flight1.Length; i++) { System.Console.WriteLine(flight1[i]); } { { } } } } }
//{ number = 1, city = "Kiev", airline = "MAU", terminal = 1 }; // { number = 2, city = "Odessa", airline = "MAU", terminal = 2 }; // { number = 3, city = "Kharkiv", airline = "MAU", terminal = 3 }; //{ number = 4, city = "Odessa", airline = "MAU", terminal = 4 };
Решение задачи: «Вывод значений элементов массива на экран»
textual
Листинг программы
for (int i = 0; i < flight1.Length; i++) { System.Console.WriteLine(string.Format("Number {0}, City {1}, Airline {2}, Terminal {3}", flight1[i].number, flight1[i].city, flight1[i].airline, flight1[i].terminal)); }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д