Program that counts all "for" instructions from a file


#include <iostream>

#include <fstream>

#include <string.h>


using namespace std;

ifstream fin ("in.ppc");


int main()

{

    char linie[100];

    int nrtot_for=0, nr_linie=0;

    while(!fin.eof())

    {

        fin.getline(linie,100);

        nr_linie++;

        if (strstr(linie,"for")>0)

        {

            nrtot_for++;

            cout << nr_linie << endl;

        }

    }

        cout << "Number of 'for' instructions in the file: " << nrtot_for;

    return 0;

}


//This program was designed in CodeBlocks - version 20.03 in the C /C++ language.


Comentarii

Postări populare de pe acest blog

Optimized SWAP gate-circuit

Counts ascending FOR loops

STATEMENT COVERAGE