Question: 2) Short coding questions: a Write the declaration for a struct called pythType that holds 3 integers named numi, num2 and num3. b) Based on

 2) Short coding questions: a Write the declaration for a struct

2) Short coding questions: a Write the declaration for a struct called pythType that holds 3 integers named numi, num2 and num3. b) Based on a), write the declaration for an array called pythNumber that holds 12 elements and each element's data type is pythType. c) Based on a) and b), write the function prototype, header and body for a function called checkPyth. It takes pythNumber as a parameter and checks to see if there exists an element which is a Pythagorean triple. Three numbers are a Pythagorean triple if they can be the lengths of the sides of a right triangle. That is, if the numbers are a, b and e then the numbers are a Pythagorean tripe if the following holds: a +bc This function returns true if there exists an element which is a Pythagorean triple, and false otherwise. 3) Short question: ure called SubSysteminfoBits that holds three fields named Write the declaration for a struct system_on in bit O, system_state in bit 1-7, system_error with 8 bits, which are all type of unsigned char. Write the declaration for a union called SubSysteminfo that holds two fields named infoAsBits typed of SubSysteminfoBits and inforAsWord typed of unsigned short. How much memory is allocated to a variable of type SubSysteminfoBits and a variable of type SubSysteminfo respectively? a) b) c) Recursion: Given an integer n>o, write a recursive C++ function that returns the sum of 1 through n. What output does the following program produce? int getValue(int a, int b, int n); 1. 2. int main() coutccgetValue(1,7,7kcendl; return 0; int getValue(int a, int b, int n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!