The structure Car is declared as follows: struct Car { string carMake; string carModel; int yearModel; double cost; }; Write a definition statement that defines a Car structure variable initialized with the following data: Make: Ford Model: Mustang Year Model: 1968 Cost: $20,000
THEN Define an array of 25 of the Car structure variables

Respuesta :

Car myCar = {"Ford", "Mustang", 1968, 20000} is the statement that defines the given data.

What are statements in a code?

A statement in computer programming is a single line of code that carries out a certain function. An illustration of a statement is the following line of code from the Perl computer language. $a = 3; A variable ($a) in this example sentence is given the value "3," which is saved as a string.

Code:

#include <iostream>

using namespace std;

/*define structure*/

struct Car{

   string carMake;

   string carModel;

   int yearModel;

   double cost;

};

int main()

{

   /*initialized struct*/

   struct Car c1 = {"Ford","Mustang",1968,20000};

   /*print all value*/

   cout<<"carMake:"<<c1.carMake<<endl;

   cout<<"carModel:"<<c1.carModel<<endl;

   cout<<"yearModel:"<<c1.yearModel<<endl;

   cout<<"cost:$"<<c1.cost<<endl;

   return 0;

}

To know more about statements refer:

https://brainly.com/question/29892325

#SPJ4

Otras preguntas

ACCESS MORE
EDU ACCESS