Guest User

Untitled

a guest
Mar 3rd, 2016
1,384
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream> //Input output stream
  2. #include <windows.h> // needed for SetConsoleTitle Function
  3. #include <ctime> //needed for clock function
  4.  
  5. using namespace std; // uses the namespace std
  6.  
  7. int main()
  8. {
  9. SetConsoleTitle( "Lose Health" ); //sets Window Title to Lose Health
  10.  
  11. int Health = 100; //Declaring health variable
  12. int start = clock(); //start - some number
  13.  
  14. cout << "Address of Health: " << &Health << endl; // Outputs address
  15.  
  16. while(Health > 0) //while health is greater than 0
  17. {
  18. if(clock() - start > 1000) //counts down every second
  19. {
  20. start = clock(); // renew the start value
  21. cout << "Health: " << Health << endl; //out puts Health
  22. Health--; //decrements Health by 1
  23. }
  24. }
  25.  
  26.  
  27. return 0;
  28. }
RAW Paste Data