Practicing Structs
Fill in the blanks to create a struct called Car
which has the following attributes:
name
of typestring
;model
of typeint
;mileage
of typefloat
.
Also fill in the blanks to complete the output statement.
index
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
struct ___
{
___;
___;
___;
}
class Program
{
static void Main(string[] args)
{
Car car;
car.model = 2023;
___ = "Hilux";
car.mileage = 2000;
Console.WriteLine($"The {car.name} has a mileage of {___} miles.");
}
}
12345678910111213141516171819202122using System; struct ___ { ___; ___; ___; } class Program { static void Main(string[] args) { Car car; car.model = 2023; ___ = "Hilux"; car.mileage = 2000; Console.WriteLine($"The {car.name} has a mileage of {___} miles."); } }
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 3
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla