Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- class Ember{
- private:
- string nev;
- string kerdesek[4] = {"Szeretsz programozni?","Szereted a fagyit?","42?","Jól vagy?"};
- string valaszok[2] = {"Igen!","Nem!"};
- public:
- Ember(string nNev){
- this->nev = nNev;
- }
- void Kommunikal(Ember *p, int kerdesIndex, int valaszIndex){
- cout << this->nev << " kerdese: " +this->kerdesek[kerdesIndex];
- cout << "\n";
- cout << p->nev << " valasza: " + p->valaszok[valaszIndex];
- }
- };
- int main()
- {
- srand(time(NULL));
- int x = rand()%3+0;
- int y = rand()%1+0;
- Ember p1("Bela");
- Ember p2("Sanyi");
- p1.Kommunikal(&p2,x,y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement