Advertisement
Guest User

Smith Counter cpp

a guest
Mar 29th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include "smith_counter.h"
  2.  
  3. #include<iostream>
  4.  
  5. using namespace std;
  6.  
  7. smith_counter::smith_counter() {
  8. count = 0;
  9. }
  10.  
  11. bool smith_counter::get_prediction() {
  12. bool prediction = count;
  13. prediction >> 1;
  14.  
  15. return prediction;
  16. }
  17.  
  18. void smith_counter::set_prediction(char taken) {
  19.  
  20. //cout << taken << endl;
  21. if ((taken == 'T') && count < 3)
  22. {
  23. count++;
  24.  
  25. //if (count > 3)
  26. // count = 3;
  27. }
  28.  
  29. else
  30. {
  31. if (count > 0 && count != 3)
  32. count--;
  33. }
  34. }
  35.  
  36. //Shayne Georgeoff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement