Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <List>
- #include <string.h>
- #include <map>
- #include <vector>
- #include <aLgorithm>
- using namespace std;
- template <typename T>
- class Punkt
- {
- public:
- Punkt( T argX, T argY, T argZ )
- : x(argX), y(argY), z(argZ)
- { }
- T x, y, z;
- };
- template <class parametr1, class parametr2>
- parametr1 mnozenie (parametr1 argument1, parametr2 argument2)
- {
- if( argument1 * argument2 > 1)
- {
- return (argument1 + argument2);
- }
- else
- {
- return 112;
- }
- if( argument1 * argument2 == 0)
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
- typedef Punkt<int> PunktInt;
- typedef Punkt<unsigned> PunktUInt;
- typedef Punkt<float> PunktFloat;
- int main()
- {
- PunktInt A(5,-15,0);
- PunktUInt B(6,10,5);
- /*1*/
- cout<<"1"<<endl;
- cout << "A(" << A.x << "," << A.y << "," << A.z << ")" <<endl; // Efekt wywoListaania metody 1
- cout << "B(" << B.x << "," << B.y << "," << B.z << ")" <<endl;
- cout <<endl;
- cout <<endl;
- /* 3 i 8 */
- cout<<" 3 "<<endl;
- list<int> Lista;
- Lista.push_back(0);
- Lista.push_front(0);
- Lista.insert(++Lista.begin(),2);
- Lista.push_back(5);
- Lista.push_back(6);
- list<int>::iterator i;
- cout << "3" <<endl;
- for(i=Lista.begin(); i != Lista.end(); ++i)
- {
- cout << *i << " ";
- }
- Lista.sort();
- cout << "Sortowanie" <<endl;
- for(i=Lista.begin(); i != Lista.end(); ++i)
- {
- cout << *i << " ";
- }
- cout <<endl;
- cout <<endl;
- cout << "Po sortowaniu wygListaada to tak" <<endl;
- cout << "Minimum ze stListaa: " <<endl;
- cout << "min(3.14,2.73)==" << min(3.14,2.73) << '\n';
- cout <<endl;
- cout <<endl;
- /*2*/
- cout<<" 2 "<<endl;
- cout << mnozenie(10, 0) <<endl;
- cout <<endl;
- cout <<endl;
- /* 4 */
- map<int, string> Videoteka;
- cout << " 4" <<endl;
- Videoteka[1] = "Kochaj i tancz";
- Videoteka[7] = "Star wars";
- Videoteka[8] = "Matrix";
- Videoteka[5] = "Dirty Dancing";
- Videoteka[6] = "KogieLista MogieLista";
- cout << "Map size: " << Videoteka.size() <<endl;
- for( map<int,string>::iterator jj=Videoteka.begin(); jj!=Videoteka.end(); ++jj)
- {
- cout << (*jj).first << ": " << (*jj).second <<endl;
- }
- cout <<endl;
- cout <<endl;
- /* piąte */
- vector<string> zadaniepiate;
- cout << " 5" <<endl;
- zadaniepiate.push_back("The number is 10");
- zadaniepiate.push_back("The number is 20");
- zadaniepiate.push_back("The number is 30");
- cout << "PetListaa po indeksie <Vektor>:" <<endl;
- int jj;
- for(jj=0; jj < zadaniepiate.size(); jj++)
- {
- cout << zadaniepiate[jj] <<endl;
- }
- cout << endl << "StaListay iterator:" <<endl;
- vector<string>::const_iterator cjj;
- for(cjj=zadaniepiate.begin(); cjj!=zadaniepiate.end(); cjj++)
- {
- cout << *cjj <<endl;
- }
- cout <<endl;
- cout <<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment