Guest User

Untitled

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