Answer to Question #341784 in C++ for LM.

Question #341784

(i) Write a function that returns the cube of the integer passed to it. For example cube(2) will

return 8 and

cube(3) will return 27.



1
Expert's answer
2022-05-19T16:41:22-0400


#include <iostream>
#include <iomanip>
using namespace std;
long long cube(int num)
{
  return num*num*num;
}
int main()
{
  int num;
  cout<<"Num:";
  cin>>num;
  cout<<cube(num)<<endl;
  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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS