#include<stdio.h>
#include<conio.h>
#define STMNT fscanf(fp,"%c",&ch)
void main()
{
FILE *fp;
int num_of_regions=1,cases=-1; //cz 1 universe region
char ch;
clrscr();
fp=fopen("input.txt","r");
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='i')
{
STMNT;
if(ch=='f')
{
num_of_regions++;
}
}
else if(ch=='w')
{
STMNT;
if(ch=='h')
{
STMNT;
if(ch=='i')
{
STMNT;
if(ch=='l')
{
STMNT;
if(ch=='e')
{
num_of_regions++;
}
}
}
}
}
else if(ch=='f')
{
STMNT;
if(ch=='o')
{
STMNT;
if(ch=='r')
{
num_of_regions++;
}
}
}
else if(ch=='c')
{
STMNT;
if(ch=='a')
{
STMNT;
if(ch=='s')
{
STMNT;
if(ch=='e')
{
cases++;
}
}
}
}
else if(ch=='d')
{
STMNT;
if(ch=='e')
{
STMNT;
if(ch=='f')
{
STMNT;
if(ch=='a')
{
cases++;
if(ch=='u')
{
STMNT;
if(ch=='l')
{
STMNT;
if(ch=='t')
{
cases++;
}
}
}
}
}
}
}
}
if(cases!=-1)
num_of_regions+=cases;
fclose(fp);
printf("\nCyclometic Complexity is = Number of regions");
printf("\n\t\t\t = %d",num_of_regions);
getch();
}
#include<conio.h>
#define STMNT fscanf(fp,"%c",&ch)
void main()
{
FILE *fp;
int num_of_regions=1,cases=-1; //cz 1 universe region
char ch;
clrscr();
fp=fopen("input.txt","r");
while(fscanf(fp,"%c",&ch)!=EOF)
{
if(ch=='i')
{
STMNT;
if(ch=='f')
{
num_of_regions++;
}
}
else if(ch=='w')
{
STMNT;
if(ch=='h')
{
STMNT;
if(ch=='i')
{
STMNT;
if(ch=='l')
{
STMNT;
if(ch=='e')
{
num_of_regions++;
}
}
}
}
}
else if(ch=='f')
{
STMNT;
if(ch=='o')
{
STMNT;
if(ch=='r')
{
num_of_regions++;
}
}
}
else if(ch=='c')
{
STMNT;
if(ch=='a')
{
STMNT;
if(ch=='s')
{
STMNT;
if(ch=='e')
{
cases++;
}
}
}
}
else if(ch=='d')
{
STMNT;
if(ch=='e')
{
STMNT;
if(ch=='f')
{
STMNT;
if(ch=='a')
{
cases++;
if(ch=='u')
{
STMNT;
if(ch=='l')
{
STMNT;
if(ch=='t')
{
cases++;
}
}
}
}
}
}
}
}
if(cases!=-1)
num_of_regions+=cases;
fclose(fp);
printf("\nCyclometic Complexity is = Number of regions");
printf("\n\t\t\t = %d",num_of_regions);
getch();
}
No comments:
Post a Comment