Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include<iostream>
  2. #include<array>
  3. #include<vector>
  4. #include<stdlib.h>
  5. #include<time.h>
  6. #include<string.h>
  7. #include<sstream>
  8. #include<list>
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13.     string input;
  14.     getline(cin, input);
  15.  
  16.     istringstream inputStream(input);
  17.     int numbers;
  18.     list<int>myList;
  19.     while (inputStream >> numbers)
  20.     {
  21.         myList.push_back(numbers);
  22.     }
  23.    
  24.     cout << "Number: ";
  25.     int numberToCheck;
  26.     cin >> numberToCheck;
  27.  
  28.     bool yes = false;
  29.  
  30.     for (int number : myList)
  31.     {
  32.         if (number == numberToCheck)
  33.         {
  34.             yes = true;
  35.         }
  36.     }
  37.  
  38.     if (yes)
  39.         cout << "Ima go " << endl;
  40.     else
  41.         cout << "Nqma go" << endl;
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement