Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Practicing Structs | Structs & Enumerators
C# Beyond Basics

book
Practicing Structs

Fill in the blanks to create a struct called Car which has the following attributes:

  1. name of type string;

  2. model of type int;

  3. mileage of type float.

Also fill in the blanks to complete the output statement.

cs

index

copy
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.");
}
}
12345678910111213141516171819202122
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."); } }

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 3

Pregunte a AI

expand
ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

some-alt