Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Short coding questions c++ Write the declaration for a struct called pythType that holds 3 integers named num1, num2, and num3. Based on a), write

Short coding questions c++

  1. Write the declaration for a struct called pythType that holds 3 integers named num1, num2, and num3.

  1. Based on a), write the declaration for an array called pythNumber that holds 12 elements and each elements data type is pythType.

  1. How much memory is allocated to the variable pythNumber?

  1. Write the statement to print out the value of the field of num2 of the 6th element of pythNumber.

  1. If you declare a variable as follow:

pythType *p=new pythType;

How would you assign 24 to num3 field in the new created node which is pointed by p?

  1. 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 c then the numbers are a Pythagorean tripe if the following holds:

a2 + b2 = c2.

This function returns true if there exists an element which is a Pythagorean triple, and false otherwise.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

5. How will the members be held accountable?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago