Guest User

Untitled

a guest
Nov 16th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <iostream>
  3. #include <string>
  4.  
  5. class Human {
  6. public:
  7.     bool Alive;
  8.     bool Happy;
  9.     string Name;
  10.     void kill(Human victim);
  11.     void troll(Human victim);
  12.     void email(Human recipient);
  13. }
  14.  
  15. Human::Human(string n) {
  16.     Alive = TRUE;
  17.     Happy = TRUE;
  18.     Name =  n;
  19. }
  20.  
  21. void Human::kill(Human victim) {
  22.     if (victim.Alive == TRUE) {
  23.         victim.Alive = FALSE;
  24.         cout << Name << " killed " << victim.Name << endl;
  25.     }
  26.     else {
  27.         cout << victim.Name << " is already dead!" << endl;
  28.     }
  29. }
  30.  
  31. void Human::troll(Human victim) {
  32.     victim.Happy = FALSE;
  33.     cout << Name << " trolled " << victim.Name << endl;
  34. }
  35.  
  36. void Human::email(Human victim) {
  37.     cout << Name << " emailed " << victim.Name <<  "." << endl;
  38. }
  39.  
  40. int main() {
  41.     Human Santi("Santi");
  42.     Human Olivia("Olivia");
  43.     Human SP("SP");
  44.     Human Writer("Mr. Writer");
  45.     Human Rachel("Rachel");
  46.     Santi.email(Writer);
  47.     SP.kill(Santi);
  48.     Olivia.kill(Santi);
  49.     Rachel.troll(SP);
  50.     Rachel.troll(Olivia);
  51. }
Add Comment
Please, Sign In to add comment