fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6.  
  7.  
  8. class Vehicle {
  9. public:
  10. int number;
  11. Vehicle(int vnumber) : number(vnumber){
  12. }
  13.  
  14. bool operator==(const Vehicle &rhs) {
  15. return rhs.number == number;
  16. }
  17. };
  18.  
  19. int findWaitingPosistion(std::vector<Vehicle> &waitingList, Vehicle const& v){
  20. if (find(waitingList.begin(),waitingList.end(),v) != waitingList.end())
  21. return 1;
  22. else
  23. return 0;
  24. }
  25.  
  26.  
  27. int main() {
  28.  
  29. std::vector<Vehicle> vList;
  30.  
  31. for (int i = 0; i < 10; ++i) {
  32. vList.push_back(Vehicle(i));
  33. }
  34.  
  35.  
  36. int a = findWaitingPosistion(vList, Vehicle(5));
  37.  
  38. cout << a << endl;
  39.  
  40.  
  41.  
  42. // your code goes here
  43. return 0;
  44. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
1