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.cs
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."); } }
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 3
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat