76 974
Assignments Done
Successfully Done
In June 2019

Answer to Question #27919 in C++ for red rose

Question #27919
Write a functions named sqrIt () that computes the square of the value passed to it and displays the result. The function would be capable of squaring numbers with decimal points. Make sure your function is called from main() .
Expert's answer
#include <iostream>

float sqrlt( float x )
float result = 0;

// calculate square
result = x*x;

//Show result
std::cout << "square=" << result <<"\n";

return result;

int main()
float x;
//Show message:
std::cout << "Enter number:\n";
//Read number:
std::cin >>x;

float square;
//call function
square=sqrlt( x );

return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions