1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alisha [4.7K]
3 years ago
6

Define a function setheight, with int parameters feetval and inchesval, that returns a struct of type heightftin. the function s

hould assign heightftin's data member feet with feetval and inches with inchesval.
Computers and Technology
1 answer:
devlian [24]3 years ago
4 0

It is given that the feetVal and inchesVal are parameters of the SetHeight() function. Since the return type of the function is structute, so we need to define a structure.

After that, we need to create a structure variable within the function definition. Now, assign the feet and inches with the feetVal and inchesVal respectively. Finally return the structure variable.

Further explanation:

#include<stdio.h>

//define the structure

typedef struct HeightFtIn_struct {

int feet;

int inches;

} HeightFtIn;

//define the function

HeightFtIn SetHeight(int feetVal, int inchesVal)

{

HeightFtIn Htft; //creating a structure variable of type HeightFtIn

//assign the value of feetVal

Htft.feet = feetVal;  

Htft.inches = inchesVal; //assigning the value of inchesval

//return the structure variable

return Htft;

}

int main(void) {

HeightFtIn studentHeight;

int feet;

 int inches;

printf("Enter the values of feet and the inches: ");

scanf("%d %d", &feet, &inches);

studentHeight = SetHeight(feet, inches);

printf("The student's height is %d feet and %d inches.\n", studentHeight.feet, studentHeight.inches);

return 0;

}

Output:

Enter the values of feet and the inches: 5 9

The student's height is 5 feet and 9 inches.

Learn more:

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. How does coding work on computers?  brainly.com/question/2257971 

Answer details:

Grade: College Engineering

Subject: Computer Science

Chapter: C  Programming

Keyword:

C++, input, output, programming, statements,  loops, if, else, statements, firstname, lastname, base class, derive class, vector, print

You might be interested in
Which of the following is incorrect? a. The operating cycle always is one year in duration. b. The operating cycle sometimes is
vlada-n [284]

Answer:

Explanation:

The operating system always is one year duration. If you don't believe me look it up. I am very good with computers.

7 0
3 years ago
Next, Nate wants to add a date placeholder to his template. First, he places his insertion point a line before the company place
Debora [2.8K]

Explanation:

When using programs such as Microsoft and other similar products, things have been made so easy, with so many features, that you can make your document look good and interesting. For the case of Nate, he wants to add a date placeholder to his template, and the best way to do this is simply to click on the INSERT tab on the ribbon.

5 0
3 years ago
Which one of the following is considered a peripheral? A Software B Mouse C USB connector D Motherboard
Bogdan [553]

A mouse is considered that out of the options listed.

5 0
3 years ago
Read 2 more answers
When does if(x!=y) execute?
Dmitriy789 [7]

Answer:

A

Explanation:

4 0
2 years ago
10. What may help drivers conserve gasoline?
ki77a [65]

Answer: C. Slowing down gradually

Explanation:

A and B suck up the gas immediately since you are using much more of it. When you brake abruptly, you are not only wasting gas, but you are also damaging your tires. Therefore, the most appropriate answer is C.

I hope this helps!! Pls mark brainliest :)

7 0
2 years ago
Read 2 more answers
Other questions:
  • Which is a function of network media?
    11·2 answers
  • Most keyboards today are in a
    8·1 answer
  • Henry Ford would have been most interested to bring which modern innovation to his automotive factories?
    5·2 answers
  • True or false? when intel places a sticker on computers showing their chip is inside, they are demonstrating their visible value
    7·1 answer
  • The​ ________ is a​ c-shaped structure that curves around the pancreas and stomach
    9·1 answer
  • Which of the following is true regarding the mod operator, %? Group of answer choices It can only be performed on int values and
    8·2 answers
  • What does aperture control? A)amount of light the image sensor captures when taking a photo. B)how sensitive the camera is to in
    10·2 answers
  • Which image-editing tool can be used to help remove spots and other marks from an image?
    13·1 answer
  • Sorry, I cant tell you, you need to know
    5·2 answers
  • Point to ______ of a cell to fill the cell to the right or down.
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!