0

AHMMM... HI guyz.. ladies and gentlemen ... thank you for responding at my 1st post hir in daniweb site...ahmmm.. i really apreciated it..

please give me some suggestion..comments and solutions to this problem briefly...

heres my codes...
MY PROBLEM is..
how to configure the country full name and its coordinate strings..
here is the correct output of the program...

OUTPUT:
Enter Country Code: US (e.g.)

US - United States: Digicel, Movistar and other telephone companies at that country...(e.g)

There is a database where the acronyms and the full name of that country with their telephone operators are completely arrange..

:'(
//another PROBLEM:

:'(when i'm input a 2 char.. the output is always the fist line of my database...(save as in filename "countrycode.csv") and it is only for reading..

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

using namespace std;
int main()
{
char code[10];
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[100][100];
        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[0])!=0)
    {
        cout << who[1]<<endl;
        exit(1);
    }
    else
    {    cout << "INVALID!!!";
            exit(1);
      }
    }
    }
fclose(f);
    }
return 0;
}
2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by thekashyap
0

THANK YOU.. For giving a suggestion to my given problem.. I truely appreciated it... thanks...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.