Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. #include <iostream>
  2. #include<cmath>
  3. #include<algorithm>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. ///////////////
  9. /////////////// CMATH
  10. //////////////
  11. cout<<pow(2,3)<<endl; //2 A HARMADIKON
  12. cout <<sqrt(2)<<endl; //2 GYÖKE
  13. cout <<pow(2,0.25)<<endl; //2 AZ EGY NEGYEDIKEN /// NEGYEDIK GYÖK 2
  14. cout <<ceil(pow(2,-3))<<endl;
  15. cout <<floor(pow(2,-3))<<endl;
  16. cout <<round(pow(2,-3))<<endl;
  17.  
  18.  
  19. double x = 3.4488;
  20. cout << round(x * 100) /100<<endl; //2 TIZEDESJEGYRE KEREKITÉS
  21.  
  22. int y =3578; //SZÁZASRA KEREKÍTÉS
  23.  
  24. cout << round((double) y /100)*100<<endl;
  25.  
  26. cout << abs(-5)<<endl; // ABSZOLÚT ÉRTÉK
  27.  
  28.  
  29. //////////////////
  30. ////////////// ALGORITHM
  31. /////////////
  32. cout <<endl;
  33. cout <<endl;
  34. cout <<"ALGORITHM"<<endl;
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. int t [] = {3,7,6,8,3,6,8,100,26,472}; // 10 ELEMŰ TÖMB
  43.  
  44.  
  45. sort(t,t+5,greater<int>()); //CSÖKKENŐ SORREND
  46. sort(t,t+3); //ELSŐ HÁROM
  47.  
  48. for (int i = 0 ; i<10;i++){
  49.  
  50. cout << t[i]<< " "<<endl;
  51. }
  52. sort (t,t+10);
  53.  
  54. int db = sizeof(t)/sizeof(t[0]); // MENNYI ELEM VAN
  55. // MEMORIA A TÖMBNEK / MEMORIA EGY ELEMNEK
  56.  
  57. cout <<endl;
  58.  
  59. sort (t,t+db);
  60. for(int i =0;i<db;i++){
  61. cout <<t[i]<<endl;
  62. }
  63.  
  64. cout <<endl;
  65.  
  66. cout <<min(2,11)<<endl;
  67. cout <<max('b','k')<<endl;
  68.  
  69. cout <<min_element(t+5,t+db)<<endl; //MEMÓRIACIMRE MUTAT
  70. cout <<*min_element(t+5,t+db)<<endl; //KIIRJA AZ ÉRTÉKÉT
  71.  
  72. fill (t+4,t+6,5);
  73.  
  74. swap (t[0],t[5]);
  75.  
  76. cout << count(t,t+db,5)<<endl;
  77.  
  78.  
  79.  
  80.  
  81.  
  82. return 0;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement