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
GoodArray hackerrank solution for a number N, a goodArray is the smallest possible array that consists of only powers of two
Paladinen [302]

Using the knowledge in computational language in python it is possible to write a code that smallest possible array that consists of only powers of two.

<h3>Writting the code in python:</h3>

<em>"public class GoodArray {"</em>

<em />

<em> "public static List<Integer> getQueryResults(long N, List<List<Integer>> queries) {"</em>

<em />

<em>  "List<Integer> res = new ArrayList<>();"</em>

<em>  int[][] arr = new int[queries.size()][3];</em>

<em>  "List<Integer> goodArray = new ArrayList<>();"</em>

<em>  "for (int i = 1; i <= N; i++) {"</em>

<em>   "int num = i;"</em>

<em>   "while (num % 2 == 0) {"</em>

<em>    "goodArray.add(num);"</em>

<em>    "num = num / 2;"</em>

<em>   }</em>

<em>  }</em>

<em>  int index = 0;</em>

<em>  for (List<Integer> l : queries) {</em>

<em>   arr[index][0] = l.get(0);</em>

<em>   arr[index][1] = l.get(1);</em>

<em>   arr[index][2] = l.get(2);</em>

<em>   index++;</em>

<em>  }</em>

<em>  Collections.sort(goodArray);</em>

<em>  "for (int i = 0; i < arr.length; i++) {"</em>

<em>   "int[] query = arr[i];"</em>

<em>   int l = query[0];</em>

<em>   int r = query[1];</em>

<em>   int m = query[2];</em>

<em>   int prod = 1;</em>

<em>   "for (int j = l - 1; j <= r - 1; j++) {"</em>

<em>    "prod = (int) (prod * goodArray.get(j)) % m;"</em>

<em>   }</em>

<em>   res.add(prod);</em>

<em>  }</em>

<em>  return res;</em>

<em> }</em>

<em />

<em>}</em>

See more about python at brainly.com/question/18502436

#SPJ1

8 0
2 years ago
Which is not covered under the Computer Access Device and Computer Fraud and Abuse Act (CADCFA)? unauthorized use of federal com
Mazyrski [523]

Answer:

The correct answer to the following question is "Typewriters".

Explanation:

CADCFA seems to be the very first provision of federal laws to specifically concentrate on computer assault. These clauses continued to allow corporations to prosecute unjust workers for compensation for the misuse of confidential or sensitive information.

  • Even though we all agree that sometimes a federal worker uses the typewriters in the abundance of power, that's why it's not protected by that same act.
  • The other options are incorrect because they are all known and are covered for that given CADCFA act.
5 0
3 years ago
write an expression taht evaluated to true if and only if the variable s does not contain the string 'end'
natima [27]

Answer:

//check which string is greater

if(strcmp(name1,name2)>0)

//assign name1 to first, if the

    //name1 is greater than name2

    first=name1;

else

    //assign name2 to first, if the

    //name2 is greater than name1

    first=name2;

5)

//compare name1 and name2

    if(strcmp(name1,name2)>0)

   

         //compare name1 and name3

         if(strcmp(name1,name3)>0)

       

             //assign name1 to max, becuase

             //name1 is greater than name2 and name3

             max=name1;

       

Explanation:

7 0
3 years ago
Why optical disk is slower than magnetic disk.?​
Mazyrski [523]

Answer:

Answer choices?

Explanation:

5 0
3 years ago
Read 2 more answers
Give three examples of NON-TRADITIONAL web authoring tools<br> 3 pour
olganol [36]
Some other type of authoring tools 1. Card or Page based tools 2. Icon based, event driven tools 3. Time based and presentation Tools.
4 0
2 years ago
Other questions:
  • Can using interior light help improve a drivers visibility at night
    9·1 answer
  • To change the size of a field or record by dragging its border a.resize b.magnify c.label d.enlarge
    11·2 answers
  • Which signal types are represented by a continuous wave form?
    11·1 answer
  • In a case where electrical current leakage from the circuit occurs, the GFCI would do the following:
    10·1 answer
  • 2.7 code practice question 1 edhesive
    13·2 answers
  • True or False?Only flying unmanned aircraft over 20lbs requires preparation and safety calculations.
    8·1 answer
  • Why is statistics important for business professionals in many career fields?
    13·2 answers
  • If your computer won't connect to the internet, which of these is most likely to be the problem?
    8·1 answer
  • Program MATH_SCORES: Your math instructor gives three tests worth 50 points each. You can drop one of the test scores. The final
    7·1 answer
  • 2. How much did John Jones have in his account on the first day of the
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!