May 15, 2014 at 11:38am UTC
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream>
int main()
{
char findname[15],pnum[15],fname[15],lname[15];
FILE *fp;
fp=fopen("file1.txt","r");
printf("Find criminal I.D number:");
scanf("%s",&findname);
while(!feof(fp))
{
fscanf(fp,"%s %s %s\n",&pnum,&fname,&lname);
if(strcmpi(findname,fname)==0||strcmpi(findname,lname)==0||strcmpi(findname,pnum)==0)
{
printf("\n\n%s %s %s\n",pnum,fname,lname);
printf("\nFound %s %s %s\n",pnum,fname,lname);
}
if(strcmpi(findname,fname)!=0||strcmpi(findname,lname)!=0||strcmpi(findname,pnum)!=0)
printf("There are no Criminal Records Found\n",findname);
}
fclose(fp);
getch();
}
======> simple, i just want to remove that many "no criminal records found, and then and what should i declare? can someone fix this for me, file handling problems.. thank you :)
May 15, 2014 at 2:44pm UTC
You know there's a beginners section of the forum, and you REALLY need to wrap the code in tags (It shows you how in beginners posting bit).