Write C++ code to: --Pass arguments by value and reference Return multiple value
ID: 3548028 • Letter: W
Question
Write C++ code to: --Pass arguments by value and reference Return multiple values from a function: compute the area AND perimeter of a rectangle
--Process an Array: find maximum/minimum value sum/average/count values passing a test (>100)
--Define a structure for weight: lbs and ozs (1lb=16 ozs) --Determine if one weight is equal to another greater than (or less than) another
Write C++ code to: --Pass arguments by value and reference Return multiple values from a function: compute the area AND perimeter of a rectangle
--Process an Array: find maximum/minimum value sum/average/count values passing a test (>100)
--Define a structure for weight: lbs and ozs (1lb=16 ozs) --Determine if one weight is equal to another greater than (or less than) another
Explanation / Answer
include <iostream.h>
#include <conio.h>
double getPerimeter(double L, double W) {
double P = (2 * L) + (2 * W);
return P;
}
int main() {
double L=40;
double W=20;
double P = getPerimeter(L, W);
cout << "The perimeter of a rectangle whose length is 40 and width is 20 is: " << P;
getch();
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.