Advertisement
tobast

Untitled

Oct 24th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <cstdlib>
  4.  
  5. #ifdef STDPOW
  6. int pow2(double pw)
  7. {
  8.     return pow(2,pw);
  9. }
  10. #endif
  11.  
  12. #ifdef MYPOW
  13. int mypow2(int pw)
  14. {
  15.     int out=1;
  16.     for(int cur=0; cur<pw; cur++)
  17.         out*=2;
  18.     return out;
  19. }
  20.  
  21. int pow2(int pw)
  22. {
  23.     return mypow2(pw);
  24. }
  25.  
  26. #endif
  27.  
  28. int main(int, char** argv)
  29. {
  30.     for(int occ=0; occ<atoi(argv[1]); occ++)
  31.     {
  32.         for(int i=0; i<atoi(argv[2]); i++)
  33.             printf("%d\t", pow2(i));
  34.         printf("\n");
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement