[qoute]SIr thnk you for a wonderful advice..
Ahmm.. briefly how will i operate the program correctly if the output of my program is always at the first line only of my database...
example... my problem is i will type a country code:
OUTPUT:
Enter Country Code : US (e.g.)
/* the answer will be like this.. */
United States: Digicel, Movistar and other telephone companies in that country,,
MY OUTPUT:
Enter Country Code: US(e.g.)
Afghanistan //this is always the reply of my input..
(at my database)
hmmm. it is something like this...
AF - Afghanistan
AX- Aland islands
......
PH - Philippines: Cure, Globe, Smart, Sun
US - United States: Digicel, Movistar etc...
/*my program is like this..
Hope u can help me..*/

#include<iostream>
#include<string>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
char code[5];
char whole[800];
cout << "\n\n\tType the Country Code: \t\t ";
cin >> code;
FILE *f;
f=fopen("countrycode.csv", "r");
if(f==NULL) cout<< "cant open";
else
{
while(fgets(whole,800,f)!=0)
{
int a=0, i;
char delimeter[]="-\"", who[800][800];
char *huj=strtok(whole, delimeter);
while(huj!=NULL)
{
strcpy(who[a],huj);
if(a++>=sizeof who/ sizeof *who)
{
break;
}
huj=strtok(NULL, delimeter);
}
for (i=0; i<a; i++)
{
if(strcmp(code,who[1])!=0)
{
strcmp(code,who[1]);
cout << who[1]<<endl;
exit(1);
}
else
{ cout << "INVALID!!!";
exit(1);
}
} }
fclose(f);
}
return 0;
}