,DIV,TABLE,THEAD,TBODY,TFOOT,TR,TH,TD,P { font-family:"Nimbus Sans L"; font-size:x-small } -->
ahmm hi everyone i'm a newbie here at daniweb.. but i have an unfinished business(project).. guys.. pls.. help me to solve this.. or give some comments or replies in my problem..

this is my problem.. i don't know what function/s should i use to compare all the chars on all the lines of my database.. ahmmm.. i want the program output will be like this..


EXPECTED OUTPUT:


Enter the Country Code: AF(ex.) // in my program if you type US afghanistan is always a reply statement..

Afghanistan: Movistar, Digicel (ex. telephone operators)

THIS IS MY CODE (hope u help me to solve my problem..:

#include<iostream>
#include<string>
#include<stdio.h>
#include<string.h>

using namespace std;
int main()
{
    char code[3];
    char whole[600];
    char who[300][300];
    cout << "\n\n\tType the Country Code: \t\t ";
    cin >> code;
    FILE *f;    
    f=fopen("countrycode.csv", "r");
    if(f==0) cout<< "SORRY can't find or open the file";
    else
    {
        while(fgets(whole,900,f)!=NULL)
        {
//char *u=strstr (whole, "-");
            int a=0, i;
//if (u==0)
//char delimeter[]="-\"";
//char who[300][300];
            {
                char *huj=strtok(whole, "-\"");
                while(huj!=NULL)
                {
                    strcpy(who[a],huj);            
                    if(++a >= sizeof who/ sizeof *who)break;
                    huj=strtok(NULL, "-\"");
                }
            //for (i=0; i<a; i++)
                //int i, b=EOF;    
                //(i=0);
                //while (i<b);    
                //while (fgets(whole, 900,f)!=NULL)
                {    
                    
                    if(strcmp(who[i],code)==0)
                    {
                        strcmp(who[0],code);
                        cout /*<< "if:"*/<<who[1]<<endl;
                        //exit(1);    
                    }
                    else 
                    {    strcmp(who[0],code);
                        cout /*<<"else:"*/<<who[1];//<< " "<<code<<endl;
                        //cout << "INVALID!!!";
                        //exit(1);
                     }
                //(i++);
                    
                }    
            }
        //cout << "while  loop: " <<whole << endl;

        }
fclose(f);
    }
return 0;
}

*******************************************************************

and that is my program code.. the database is save as .csv file format.. ahmm please give me some advice..

At my database is look like this

AF - Afghanistan: (telephone operators)
AX - Aland Island: (not yet found its telephone operator)
....
US - United States: Digicel, Movistar, Us Phone Company...etc..

*******************************************************************

and this is my program hope that i finish this project as soon as possible.. thnks.. God Bless!

we have already gone over this problem here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.