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
svetlana [45]
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:
ehidna [41]3 years ago
6 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
A Linux-based OS is called a _____.
solong [7]
It is called kernel
7 0
3 years ago
which programming paradigm do programmers follow to write code for event driven applications? a. object oriented programming. b.
7nadin3 [17]

Answer:

D) Procedural

Explanation:

7 0
3 years ago
Help debugging line 7 type error more arguments (5) than expected (1)
kolezko [41]

Answer:

import random

score = 0

for i in range(5):

   num1 = random.randint(1, 100)

   num2 = random.randint(1, 100)

   prompt = "What is " + str(num1) + "+" + str(num2) + "?"

   answer = int(input(prompt))

   result = (num1, num2)

   if answer == result:

       print("Well done!")

       score += 1

   else:

       print("incorrect")

print("Your score was", score)

Explanation:

Your error is on <em>line 7</em>, where you are providing multiple arguments to the input function, instead of 1.

One way to solve this is to create a variable prompt and concatenate all strings and variables within that variable to use for the input.

3 0
1 year ago
The process of searching for a special pattern of symbols within a larger collection of information is called pattern ____.
tatuchka [14]

Answer:

Pattern Matching

Explanation:

Pattern matching in computer science is defined as the analysing & finding specific sequences of data of some pattern among raw data or a sequence of tokens.

4 0
3 years ago
Which of the following is one way a corporation can raise money?
Vladimir [108]
Selling stock on the stock market
4 0
4 years ago
Other questions:
  • What is one reason the SOC categorizes occupations as it does?
    9·1 answer
  • When you choose the ____ compression setting, photos are compressed to the resolution specified on the advanced tab in the power
    13·2 answers
  • The protocol that enables computers on the Internet to communicate with one another is called _____.
    5·1 answer
  • ANSWER THESE RIDDLES FOR BRAINLIEST ANSWER!!!!
    11·2 answers
  • Why dose this keep popping up i dont understand plz resond first person gets branilest
    13·1 answer
  • Colin Mackay Inc., a software company with its head office in Amsterdam, has employees across three continents. Certain project
    11·1 answer
  • Which role involves designing and creating advertisements for marketing purposes?
    14·1 answer
  • What are different between system and application software?​
    14·1 answer
  • 5. Why do we need programming language?​
    13·2 answers
  • Exam Instructions
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!