Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define sf scanf
- #define pf printf
- using namespace std;
- bool keys( string input )
- {
- // freopen("in.txt","rt",stdin);
- string dict[2048]={
- "or","or_eq","private","protected","public","reflexpr",
- "register","reinterpret_cast","requires","return","short",
- "signed","sizeof","static","static_assert","static_cast",
- "struct","switch","synchronized","template","this","thread_local",
- "throw","true","try","typedef","typeid","typename","union",
- "while","xor","xor_eq","alignof","and","and_eq","asm","auto",
- "bitand","bitor","bool","break","case","catch","char","continue",
- "default","delete","do","double","else","false","float","for","friend",
- "goto","if","import","inline","int","long","mutable","namespace","new",
- "not","operator",
- };
- for( int i=0; i<65; i++ )
- {
- if( dict[i] == input ) return true;
- }
- return false;
- }
- int main()
- {
- cout << "Enter A string to check keyword: ";
- string in;
- while(cin >> in)
- {
- if( keys( in ) )puts("Yeah! it's a keyword");
- else puts(" Not a keyword in dictionary ");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement