Question

Using C, practice more with structure. Example make Car struct and give member: char mak[15]; double...

Using C, practice more with structure. Example make Car struct and give member:

char mak[15];

double price;

char vinNum[15]; // Note make sure you have a member that uniquely identify struct.

example Student ID

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

#include <stdio.h>
struct Car{

char mak[15];

double price;

char vinNum[15]; // Note make sure you have a member that uniquely identify struct. example Student ID

};


int main()
{
struct Car c1;
c1.mak[0]='a';
c1.mak[1]='\0';
c1.price=3.4;
c1.vinNum[0]='1';
c1.vinNum[1]='\0';
printf("%s\n",c1.mak);

return 0;
}

Chrome File Edit View History Bookmarks People Tab Window Help 44% (4) Tue 5:38 AM Q M Inbox - gurkaranpreet.singh.mx CUsing

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Using C, practice more with structure. Example make Car struct and give member: char mak[15]; double...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the following C struct that represents a complex number. struct complex {    double real;    double...

    Consider the following C struct that represents a complex number. struct complex {    double real;    double imaginary; }; (a) [20 points/5 points each] Change this struct into a class. Make the member variables private, and add the following to the class: A default constructor that initializes the real and imaginary parts to 0. A constructor that allows initialization of both real and imaginary parts to any double value. A public member function that returns the magnitude of the complex number....

  • C programming The program will require the following structure: struct _data { char *name; long number;...

    C programming The program will require the following structure: struct _data { char *name; long number; }; The program will require command line arguments: int main(int argv, char **argc) { Where argv is the number of arguments and argc is an array holding the arguments (each is a string). Your program must catch any case where no command line arguement was provided and print a warning message (see below). You MUST include/use the following functions, defined as follows: int SCAN(FILE...

  • I need this in C++ Write a function using the following structure and prototype. struct Stats...

    I need this in C++ Write a function using the following structure and prototype. struct Stats { float avg; //Average value of an integer array float median; //Median value of an integer array int *mode; //array containing the modes int nModes; //number of modes in the array int maxFreq; //max frequency of modes }; Stats *avgMedMode(int *,int); The function takes in an integer array and the size of the array. Then returns a pointer to a structure containing the average,...

  • C++ Question 15 3.95 pts struct Person int age; char gender; double weight: string name; Person...

    C++ Question 15 3.95 pts struct Person int age; char gender; double weight: string name; Person p[35, 'M', 175.5, "Steve"); Which of the options below correctly represents how the structure object p is stored in memory? RAM (Memory) Address Value Address o Address 1 Address 2 Address 3 Address 4 Which of the options below correctly represents how the structure object p is stored in memory? B-) RAM (Memory) Address Value Address 0 Address 1 Address 2 Address 3 Address...

  • Function Name: stPaddysFeast Example search- Inputs 1 (struct) A MxN structure array 2. double) A...

    Using MATLAB, please read question well Function Name: stPaddysFeast Example search- Inputs 1 (struct) A MxN structure array 2. double) A 1x2 vector of your starting position: [row, column] next: [1, 3] next: [1, 1] next: [2, 1) food: 'potato food potato next: 2, 3] step 2 food: start next: [2, 2] food: 'potato' step 3 Outputs next [1, 21 food: food: 1. (ohar)A descriplion of how mary potatoes you found ad where you stopped looking step 4 (stop) Background...

  • Using C programming Using the supplied example code as a starting point, add 3 more conversions...

    Using C programming Using the supplied example code as a starting point, add 3 more conversions using strtod(). Make sure you change the output conversion for type double. Use the same input strings and base codes as the strtol() function example but notice how the numbers are now represented. Manipulate the width and precision as needed for a good presentation.   Supplied code: #include <stdio.h> #include <string.h> int main(void) { long num; char* ptr; num = strtol("12345 Decimal Constant: ", &ptr,...

  • C++ Program 1a. Purpose Practice the creation and use of a Class 1b. Procedure Write a...

    C++ Program 1a. Purpose Practice the creation and use of a Class 1b. Procedure Write a class named Car that has the following member variables: year. An int that holds the car’s model year. make. A string object that holds the make of the car. speed. An int that holds the car’s current speed. In addition, the class should have the following member functions. Constructor. The constructor should accept the car’s year and make as arguments and assign these values...

  • Write a program (C++) that shows Game sales. The program should use a structure to store...

    Write a program (C++) that shows Game sales. The program should use a structure to store the following data about the Game sale: Game company Type of Game (Action, Adventure, Sports etc.) Year of Sale Sale Price The program should use an array of at least 3 structures (3 variables of the same structure). It should let the user enter data into the array, change the contents of any element and display the data stored in the array. The program...

  • Project 8 – Populating a struct and saving it. This is another “switch” assignment. Rather like...

    Project 8 – Populating a struct and saving it. This is another “switch” assignment. Rather like the scenarios, here you must select someone else's posted .h file, post a claim, and using it, codepopulating their struct with values you choose. Here “populate” means to give each member a value, using assignment operators and strcpy ( ) as needed. This all assumes you completed Project 7 first! You can't skip ahead on this one. I populated the Cat fluffy in my...

  • C++, use the skeleton code to make a program of the following

    c++, use the skeleton code to make a program of the following include <iostream> tinclude <string> using namespace std; class car public: //define your functions here, at least 5 private: string name; int mpg; double price int horsepower; // feel free to add more atributes int main() // create you objects, call your functions // define member functions here For this lab, write a program that does the following: Creates a class based on the car skeleton code (you may...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT