Thread: How should I go about doing this?

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    59

    How should I go about doing this?

    Well, I want to create an app that will converter normal letters, into a more complicated form. For instance, "Brick house," would become, "BE are eye sea kay aych oh you es ee." All I need to know in order to do this is just, how to begin. I do not expect you to write this for me so don't think that. I just do not know how to begin, at all. I think I might have to use, "char," or a data file but I don't know how I'll link that to the user inputted sentence, or phrase, and have them edit the file. Well any help would be appreciated.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    First you'll need all of the phonetic representations stored somewhere. You could just create an array of char pointers and initialize them or load the data from a file.
    If you store the phonetic representations in the same order as the coresponding letters apear in the alphabet then whenever you encouter a letter you can use it's value to get a pointer to a phonetic representation.
    Consider an array like thi
    Code:
    char * Array[]={
       "AY",
       BE
    };
    and then
    Code:
    if (CharValue>= 65 && <= 90)
       Pointer=Array[CharValue-65];
    else if (CharValue>=97 && CharValue<=122)
       Pointer=Array[CharValue-97);

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    i think the easiest way to go about it is

    Code:
    ;
    
    //EDIT:THIS CODE WON'T WORK - USE CODE IN LAST POST
    char *words[] = {"aye", "be", "sea", .....}
    char str[] = "brick house";
    
    for(int i = 0; i < strlen(str); i++)
    	cout << (str[i] - 'A' /* - 1 ??*/) << endl;
    Last edited by misplaced; 04-04-2005 at 07:58 PM.
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  4. #4
    Registered User
    Join Date
    Feb 2005
    Posts
    59
    Ah, thank you guys so very much. I'll start working on this right away, and post if I run into any major problems.

Popular pages Recent additions subscribe to a feed