Advertisement
Robert_JR

String

Oct 18th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. //#include <algorithm>
  4. //#include <cmath>
  5. //#include <ctime>
  6. //#include <string>
  7. //#include <cstdlib>
  8. //#define ll long long int
  9. //#define TESTCASE int t;scanf("%d", &t);for(int i = 0; i < t; i++)
  10. //#define PF printf
  11. //#define SF scanf
  12. #define STDIN freopen("in.txt", "rt" , stdin);
  13. //#define STDOUT freopen("out.txt", "wt", stdout);
  14.  
  15. using namespace std;
  16.  
  17. string str[1000000];
  18.  
  19. int main()
  20. {
  21.     string numberToSearch = "looooooooooooool";
  22.     int n = 10000;
  23.     //cin >> numberToSearch;
  24.  
  25.     STDIN
  26.  
  27.     string num;
  28.     int index = 0;
  29.     bool flag = false;
  30.  
  31.     while(cin >> num)
  32.         str[index++] = num;
  33.  
  34.     //int start_time = clock();
  35.     //for(int i = 0; i < 10; i++) cout << str[i] << endl;
  36.  
  37.     for(int i = 0; i < n; i++)
  38.     {
  39.         if(str[i] == numberToSearch)
  40.         {
  41.             flag = true;
  42.             break;
  43.         }
  44.     }
  45.  
  46.     //int end_time = clock();
  47.  
  48.     if(flag) cout << "Found" << endl;
  49.     else cout << "Not Found" << endl;
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement