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
What are the benefits of maintaining your vehicle?
Katarina [22]
<span>The correct answer is D - all of the above. It's important to maintain a vehicle to keep it road-worthy for as long as possible without compromising fuel economy, environmental impact or safety. It may also be a legal requirement.</span>
3 0
3 years ago
Read 2 more answers
The _____ provides a basis for creating the project schedule and performing earned value management for measuring and forecastin
inna [77]

Answer:

WBS

Explanation:

<h2><u>Fill in the blanks</u></h2>

The <u>WBS</u> provides a basis for creating the project schedule and performing earned value management for measuring and forecasting project performance.

6 0
2 years ago
What is the output of this program?
vladimir1956 [14]

All of the conditions of the elif statement are true. numA does equal 2 and numB does equal 3.

The output of this program is no.

3 0
2 years ago
Medium-term goals describe what you want your business to achieve (a) in ten years, (b) in terms of market share, (c) in two to
77julia77 [94]

The correct answer to this question is Choice C- in two to five years.

Your medium-term goals may build upon your short term goals. For example, your short term goal may be to save $1,000. Building upon this, your medium-term goal could be to save $5,000.

3 0
3 years ago
ven int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 5
monitta

Answer:

Following are statement is given below

int  k=1,total=0; // variable declaration

while(k<50) // iterating the while loop

{

   total=total+k*k;//  calculating the square

   k=k+1; // increments the value of k by 1    

}

Explanation:

Following are the description of Statement.

  • Declared a variable "total" and "k" of the "integer " type initialized the total to 0 and "k" to 1.
  • Iterating the while loop for less then 50 .In this loop, we calculating the sum of square of first 50 number in the "total" variable .
  • After that increment the value of "k" variable by 1 to execute the loop less then 50 .

3 0
3 years ago
Other questions:
  • How many buttons does a gamecube controller have?
    7·1 answer
  • When you purchase software in a box, reading the ________ is important to know if the software will function properly?
    13·1 answer
  • A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 servings in the bag and that a se
    10·1 answer
  • It takes 2.5 yards of material to make a dress harleys clothing design estimates that they can produce 48 dresses each week.if t
    15·2 answers
  • bro this scared me, i thought i just got hacked, could someone explain why when i went to ask a question, it kicked me out my ac
    9·2 answers
  • Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the functio
    15·1 answer
  • What is motivation and state the two forms​
    14·1 answer
  • Avi does not want to save his internet browsing details on his computer. What should he do?
    11·1 answer
  • Anyone who do bug bounty hunt ?​
    10·1 answer
  • Please help me.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!