need help plz! Complete the program so that the user enters in the height & widt
ID: 645670 • Letter: N
Question
need help plz!
Complete the program so that the user enters in the height & width of the rectangle and the resulting area & perimeter are printed out. Make sure the calculations of area & perimeter are in a function named calculateRectangle and that you print out the results back in the main function. The calculateRectangle function should be a void function. Compile and run the program using the data in the example screen capture below. Take a screen capture of the program running and past in the document titled Lesson Set 6.2 Screen Captures.Explanation / Answer
int main()
{
float area, perimeter, heigth, width;
cin >> heigth >>width;
// calculate rectangle being called
void cal_rect(&area, &perimeter, &heigth, &width);
cout<<("the area is %d",area);
cout<<("the perimeter is %d",perimeter);
return 0;
}
void cal_rect(int *area, int *perimeter, int *length, int *breadth)
{
area = length * breadth;
perimeter = 2 * (length + breadth);
}}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.