So I need to count the number of conditional statements in C++ source code:
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main ()
{
char str[] = "String variable";
cout << strstr (str,"variable") << endl;
return 0;
}
I need to do a string search rather than a semantic one since this is a course work and I don't think they expect something impressive. Problem is, how do I tell the strstr()
function to look into the whole source code instead of a single variable passed as the first parameter? Also, is this a good approach to solving the assignment?