Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4. // math.h
  5.  
  6. using namespace std;
  7. /*
  8. bool sajat(int x, int y){
  9. if ...
  10. return true;
  11. }
  12. */
  13. int main()
  14. {
  15.     cout<<pow(2,3)<<endl; //2^3 double
  16.     cout<<sqrt(2)<<endl; //gyok 2 double
  17.     cout<<pow(2,-3)<<endl;
  18.     cout<<ceil(pow(2,-3))<<endl;  // kerek fel
  19.     cout<<floor(pow(2,-3))<<endl; //egész rész
  20.     cout<<round(pow(2,-3))<<endl; // round sima kerekit
  21.     double x=3.4488; //2 tizedes jegyzre kerekisd
  22.     cout<< round(x*100)/100<< endl;
  23.  
  24.     int y=3578; //százasokra kerekítés
  25.  
  26.     cout<<round((double)y/100)*100<< endl;
  27.     cout <<abs(-3.1472)<< endl;
  28.     cout << "Hello world!" << endl;
  29.  
  30.     int t[]={ 7, 3,4 ,1,7,11,21,32};
  31.  
  32.     sort(t,t+3);
  33.     for(int i=0;i<8;i++){
  34.         cout<<t[i]<<" ";
  35.     }
  36.     cout<<endl;
  37.     //sort(t,t+8); //TÖMB DB SZÁMIG RENDEZVE VAN
  38.     int db=sizeof(t)/sizeof(t[0]);
  39.     sort(t,t+db);
  40.       for(int i=0;i<8;i++){
  41.         cout<<t[i]<<" ";
  42.     }
  43.  
  44.     cout<<endl;
  45.  
  46.     cout<<min(2,11)<<endl;// min(a,b)  if(a>b....
  47.     cout<<max('b','k')<<endl;
  48.  
  49.     cout<<min_element(t,t+db)<<endl; //helye
  50.     cout<<*min_element(t,t+db)<<endl; //érték
  51.  
  52.  
  53.    //lehet ilyet is  cout<<min_element(t+i,t+db-j)<<endl;
  54.  
  55.     fill(t+2,t+4,5); // tol ig kitölt számmal
  56.     //csere
  57.     swap(t[0],t[5]); //kell egy csere változó
  58.  
  59.     cout<<count(t,t+db, 5)<<endl; // tól ig keers egy értéket
  60.  
  61.      sort(t,t+db, greater<int>()  ); //csökkenő sorrendet
  62.       for(int i=0;i<8;i++){
  63.         cout<<t[i]<<" ";
  64.     }
  65.  
  66.  
  67.  
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement