Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » C++ » Solved Programs on C++ » C++ Program to find Keywords of any C++ program

C++ Program to find Keywords of any C++ program

#include <iostream>
using namespace std;

char keywords[] = "int char string int double return auto breka; case const continue default do long register short signed sizeof static struct switch typedef union unsigned void volatile while double else enum extern  float for goto if";
char keywordList[100];
unsigned int keywordCounter = 0;
void keywordChecker(char **);

int main()
    memset(keywordList, NULL, sizeof(keywordList));	
    string line;
    /*input.txt has some c++ program*/
    ifstream myinputdocumnt("input.txt");
    /*output.txt will have uncommented code from input.txt and also prints Keyword List */
    ofstream myoutputdocumnt("output.txt");
    int c=0;
            char* newline=new char[line.length()+1];
            for(int i=0;i2)   {
			strcat(keywordList, p);
			strcat(keywordList, " ");
		p = strtok(NULL, *ptr);

Content of input.txt file

C++ proram to find keyword

Content of ouput.txt file

C++ keyword analyser

Output of above C++ program

C++ keyword parser