Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include<iostream>
- using namespace std;
- class multime {
- public:
- int v[100],n;
- multime ();
- multime (int);
- int apartine(int);
- void citire ();
- void afisare ();
- };
- #include <iostream>
- using namespace std;
- #include "multime.h"
- multime ::multime ()
- {
- n=0;
- }
- multime :: multime (int x)
- {
- n=1;
- v[1]=n;
- }
- int apartine (int x)
- {
- for(int i=1;i<=n;i++)
- if(v[i] == x)
- return 1;
- return 0;
- }
- void multime :: citire ()
- {
- int x,k,i;
- cin>>n>>x;
- v[1]=x;
- k=n;
- n=1;
- for(i=2;i<=n;i++)
- {
- do{cin>>x;}
- while(this->apartine(x));
- v[++n]=x;
- }
- }
- void multime :: afisare ()
- {
- cout<<"M = {";
- for(int i=1;i<=n;i++)
- cout<<v[i]<<",";
- cout<<"}";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement