Pow Function

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2008
Posts: 268
Reputation: Traicey is an unknown quantity at this point 
Solved Threads: 19
Traicey's Avatar
Traicey Traicey is offline Offline
Posting Whiz in Training

Pow Function

 
0
  #1
Apr 2nd, 2008
Im a Novice in C++ and Im writting test in few weeks time... have got this question paper and there is something about pow function... when I asked my instructor about it, he just gave me his usually glance and say I must figure it out....well now back to my concern...what is pow function, how does it work, when and where do u use it, have got some information from the net and have heard that is a power something but I dont believe that the info I have got is enough... coz it doesnt really give me an answer to my questions maybe am searching from the wrong sources... if possible I wud appreciate an example with such function

I’m not sure if this time around im being lazy or what…. Have paged my text book from the 1st page to the last one but no lucky I think Massonon hath 4got to include it in his last edition
Some people get so rich they lose all respect for humanity. That's how rich I want to be.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 49
Reputation: leverin4 is an unknown quantity at this point 
Solved Threads: 3
leverin4 leverin4 is offline Offline
Light Poster

Re: Pow Function

 
0
  #2
Apr 2nd, 2008
The following code is a very simple program using the pow function. It is in the cmath library, so you need to make sure you include that. The output for the program would be:

The cube of 4 is 64.

  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. int main() {
  5.  
  6. int num = 4, cube;
  7. cube = pow (num, 3);
  8.  
  9. cout << "The cube of " << num << " is " << cube << ".\n";
  10.  
  11. return 0;
  12.  
  13. }

Hope that helps.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 17
Reputation: White-Gandalf is an unknown quantity at this point 
Solved Threads: 3
White-Gandalf White-Gandalf is offline Offline
Newbie Poster
Join Date: Mar 2008
Posts: 268
Reputation: Traicey is an unknown quantity at this point 
Solved Threads: 19
Traicey's Avatar
Traicey Traicey is offline Offline
Posting Whiz in Training

Re: Pow Function

 
0
  #4
Apr 3rd, 2008
Thanx guys a lot thats really appreciated
Some people get so rich they lose all respect for humanity. That's how rich I want to be.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC