Advertisement
iamyeasin

Untitled

Feb 3rd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define sf scanf
  3. #define pf printf
  4.  
  5. using namespace std;
  6.  
  7.  
  8. bool keys( string input )
  9. {
  10. // freopen("in.txt","rt",stdin);
  11. string dict[2048]={
  12. "or","or_eq","private","protected","public","reflexpr",
  13. "register","reinterpret_cast","requires","return","short",
  14. "signed","sizeof","static","static_assert","static_cast",
  15. "struct","switch","synchronized","template","this","thread_local",
  16. "throw","true","try","typedef","typeid","typename","union",
  17. "while","xor","xor_eq","alignof","and","and_eq","asm","auto",
  18. "bitand","bitor","bool","break","case","catch","char","continue",
  19. "default","delete","do","double","else","false","float","for","friend",
  20. "goto","if","import","inline","int","long","mutable","namespace","new",
  21. "not","operator",
  22. };
  23.  
  24. for( int i=0; i<65; i++ )
  25. {
  26. if( dict[i] == input ) return true;
  27. }
  28. return false;
  29. }
  30.  
  31.  
  32. int main()
  33. {
  34. cout << "Enter A string to check keyword: ";
  35. string in;
  36. while(cin >> in)
  37. {
  38. if( keys( in ) )puts("Yeah! it's a keyword");
  39. else puts(" Not a keyword in dictionary ");
  40.  
  41. }
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement