Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- class intreg
- {
- private:
- char *v=new char[cifre];
- int cifre;
- public:
- intreg(char*c, int cif);
- void set_v(char*c,int cif);
- void afisare();
- };
- intreg::intreg(char*c,int cif)
- {
- this->v=c;
- this->cifre=cif;
- }
- void intreg::set_v(char*c,int cif)
- {
- for (int i=0; i<cifre+1; i++)
- {
- v[i]=c[i];
- }
- }
- void intreg::afisare()
- {
- for(int i=0; i<cifre+1; i++)
- cout<<v[i];
- }
- int main()
- {
- int cif;
- char *c=new char[cif];
- cin>>cif;
- cin>>c;
- intreg ob(c,cif);
- ob.set_v(c,cif);
- ob.afisare();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement