Advertisement
Guest User

Untitled

a guest
Feb 15th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int ilosc_liczb;
  10.  
  11. cin>>ilosc_liczb;
  12.  
  13. // 1. done & checked
  14.  
  15. int liczbaN[ilosc_liczb];
  16.  
  17. for(int i=0;i<=(ilosc_liczb-1);i++)
  18. {
  19. cin>>liczbaN[i];
  20. }
  21.  
  22. // 2. done & checked
  23.  
  24. int dlugoscN[ilosc_liczb];
  25.  
  26. for(int j=0;j<=(ilosc_liczb-1);j++)
  27. {
  28. int len=1;
  29.  
  30. if (liczbaN[j]>10)
  31. {
  32. for (len=0; liczbaN[j]>0;len++)
  33. {
  34. liczbaN[j]=liczbaN[j]/10;
  35. }
  36. }
  37. len>>dlugoscN[j];
  38. }
  39.  
  40. // 3. done & checked
  41.  
  42. double potega,podstawa=10;
  43. double dlugosc;
  44.  
  45. for(int l=0;l<=(ilosc_liczb-1);l++)
  46. {
  47. int x=dlugoscN[l];
  48. cout<<x<<endl;
  49. dlugosc=x;
  50. cout<<dlugosc<<endl;
  51.  
  52. potega=pow(podstawa,dlugosc);
  53. int ipotega;
  54. ipotega=potega;
  55. cout<<potega<<endl<<"------"<<endl;
  56. cout<<ipotega<<endl<<"========"<<endl;
  57.  
  58. cout<<fixed<<(dlugoscN[l]+(ipotega*liczbaN[l]))<<endl;
  59. }
  60.  
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement