Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <algorithm>
- // math.h
- using namespace std;
- /*
- bool sajat(int x, int y){
- if ...
- return true;
- }
- */
- int main()
- {
- cout<<pow(2,3)<<endl; //2^3 double
- cout<<sqrt(2)<<endl; //gyok 2 double
- cout<<pow(2,-3)<<endl;
- cout<<ceil(pow(2,-3))<<endl; // kerek fel
- cout<<floor(pow(2,-3))<<endl; //egész rész
- cout<<round(pow(2,-3))<<endl; // round sima kerekit
- double x=3.4488; //2 tizedes jegyzre kerekisd
- cout<< round(x*100)/100<< endl;
- int y=3578; //százasokra kerekítés
- cout<<round((double)y/100)*100<< endl;
- cout <<abs(-3.1472)<< endl;
- cout << "Hello world!" << endl;
- int t[]={ 7, 3,4 ,1,7,11,21,32};
- sort(t,t+3);
- for(int i=0;i<8;i++){
- cout<<t[i]<<" ";
- }
- cout<<endl;
- //sort(t,t+8); //TÖMB DB SZÁMIG RENDEZVE VAN
- int db=sizeof(t)/sizeof(t[0]);
- sort(t,t+db);
- for(int i=0;i<8;i++){
- cout<<t[i]<<" ";
- }
- cout<<endl;
- cout<<min(2,11)<<endl;// min(a,b) if(a>b....
- cout<<max('b','k')<<endl;
- cout<<min_element(t,t+db)<<endl; //helye
- cout<<*min_element(t,t+db)<<endl; //érték
- //lehet ilyet is cout<<min_element(t+i,t+db-j)<<endl;
- fill(t+2,t+4,5); // tol ig kitölt számmal
- //csere
- swap(t[0],t[5]); //kell egy csere változó
- cout<<count(t,t+db, 5)<<endl; // tól ig keers egy értéket
- sort(t,t+db, greater<int>() ); //csökkenő sorrendet
- for(int i=0;i<8;i++){
- cout<<t[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement