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
Evgesh-ka [11]
4 years ago
5

Complete the function ConvertToFeetAndInches to convert totalInches to feet and inches. Return feet and inches using the HeightF

tIn struct. Ex: 14 inches is 2 feet and 2 inches.
#include


typedef struct HeightFtIn_struct {

int feet;

int inches;

} HeightFtIn;


HeightFtIn ConvertToFeetAndInches(int totalInches) {

HeightFtIn tempVal;


/* Your solution goes here */


}


int main(void) {

HeightFtIn studentHeight;

int totalInches;


scanf("%d", &totalInches);

studentHeight = ConvertToFeetAndInches(totalInches);

printf("%d feet and %d inches\n", studentHeight.feet, studentHeight.inches);


return 0;

}
Computers and Technology
1 answer:
MrRa [10]4 years ago
7 0

Answer:

  The solution to this question with code explaination is given below in explanation section.              

Explanation:

#include <iostream>

typedef struct HeightFtIn_struct {// declaring struct for feet and inches

int feet;  

int inches;

} HeightFtIn;

HeightFtIn ConvertToFeetAndInches(int totalInches) {// function to convert to feet and in inches from total inches

   

int inches = totalInches;// declare inches local variable in ConvertToFeetAndInches function.

int feet = inches/12;// convert total inches into feet;

int leftInches = inches%12;// remaining inches after converting total inches into feet

HeightFtIn tempVal;// declare HeightFtIn_struct variable to store the value of inches and feets.

tempVal.feet = feet;// store feet value

tempVal.inches = leftInches;// store remaining inches after converting totalInches into feet

return tempVal;// return feets and inches.

/* Your solution goes here */

}

int main(void) {

HeightFtIn studentHeight; // declare HeightFtIn_struct variable studentHeight;

int totalInches;// declaring totalInches variable.

scanf("%d", &totalInches);// prompt user to enter totalInches;

studentHeight = ConvertToFeetAndInches(totalInches);// ConvertToFeetAndInches

printf("%d feet and %d inches\n", studentHeight.feet, studentHeight.inches);//display converted feet and inches from totalInches;

return 0;

}

You might be interested in
Match the following tasks with their appropriate timing.
Oliga [24]

Answer:

3. 1. 2. daily, weekly, monthly

Explanation:

8 0
3 years ago
What data type would best hold the numeric value?
zaharov [31]

Explanation:

I think option b. integer data type is the suitable answer.

7 0
3 years ago
Instructions:Emotet is an advanced banking Trojan that primarily functions as a downloader of other Trojans. According to the Sy
Nastasia [14]
I do not understand what you’re question is
3 0
3 years ago
Read 2 more answers
Write a function insert that takes an array of integers in ascending order, the number of integers currently in the array, the t
Andrei [34K]

Answer:

The code is written in MATLAB

function insert(array,integer,capacity,newInt)

if integer == capacity %if the array is full, the function returns the original array

result = array;

else

if newInt < array(1) %If the new integer is less than the first element, it copies the new integer as the new first element

array = [newInt array];

elseif newInt > array(end) %If the integer is greater than the last element, it copies the new integer as the new last element

array = [array newInt];

else %If the new integer is inside the array, then it checks its new place

for i = 1:length(array)-1

if array(i+1) > newInt % once the place of the new integer is found, the rest of the array is saved in a dummy array

dummy = array(i+1:end);

array(i+1) = newInt;

array(i+2:end) = '';%the rest of the array is deleted

array = [array dummy]; %concatanate the dummy array with the newInteger inserted array

break

end

end

end

end

fprintf('The inserted integer is %g\n', newInt);

fprintf('The new array is \n',array);

disp(array)

3 0
3 years ago
A rang check that could be use to validate... Date and time
lisov135 [29]

A range check is often used when a person works with data consisting of numbers, dates and times, or currency, ensuring that a number is within a specific range.

Explanation:

  • Range checks allow a person to set suitable boundaries.
  • An example of a range check is checking to see if the value of a 16-bit integer is within the capacity of a 16-bit integer. When a range check is performed, upper and lower boundaries are specified.
  • Range check is a validation check which can be applied to numeric fields. This is done to ensure that only numbers within a certain domain can be entered into a field. Remember that this does not necessarily mean that the data entered will be correct. But it will certainly lie within reasonable limits.
  • A method of validation which checks that data falls between an upper and lower acceptable value.
  • This validation check which can be applied to numeric fields. This is done to ensure that only numbers within a certain domain can be entered into a field. Remember that this does not necessarily mean that the data entered will be correct. But it will certainly lie within reasonable limits.
5 0
3 years ago
Other questions:
  • ________ to a base class may be assigned the address of a derived class object.
    8·2 answers
  • Of the following occupations, which is predicted to have the greatest job growth?
    7·2 answers
  • What is an LMS and how is it used?
    8·1 answer
  • DJ wants to see how his document will look when printed. Where would he find the button to see the document in print view?
    12·2 answers
  • 7x+ 2x = 14<br>want is (x)?​
    15·1 answer
  • Go in my discord server Code is . (CebjBXN)​
    10·2 answers
  • O O O O O O O
    9·1 answer
  • Daniel has a list of numbers that are not in any order. He wants to find the order of the numbers with the help of a spreadsheet
    10·1 answer
  • Can someone please help me with this ,it is my assignment of technology and agriculture year 8
    5·1 answer
  • Using AI to filter potential job applicants might be considered _____
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!