Help with logic, array, chars

I am trying to create two functions, E_function and D_function. The two functions will be compared to an array of alphabet letters. I want to take input from a file like this:

E frog hat
D NOODLE DOG
E rat fat

etc..

I Want to take the words from each line and change the data and manipulate it in a function. The 'E' function will make all the letters upper case and change the position of row and col in respect to alphabet array. Blank spaces are not compared, they stay as blank spaces. I gather the data like this.


[code]


fin.ignore(100,'\n');
fin.get(ch);

while (fin)
{
cout << ch;
fin.ignore(100,'\n');
fin.get(ch);
}

switch(ch)
{

case E: E_function (fin,array[], fout);

case D: D_function (fin,array[], fout);


}
[code]

I'm struggling with creating each function. I think i need to create a second array for my input to compare to alphabet array? If anyone has any useful suggestions that would be super helpful. thank you
What is 'ch'? A char? A char *?
oops sorry, yes ch is a char :P
Well, first things first:

1
2
3
4
5
6
7
8
9
fin.ignore(100,'\n');
fin.get(ch);

while (fin)
{
cout << ch;
fin.ignore(100,'\n');
fin.get(ch);
}


line 1: Throw away a line of input.
line 2: get a character.

line 6: print a character.
line 7: throw away a line of input.
line 8: get a character, overwriting the last character extracted.

That's a lot of stuff you're throwing away given the file format you specified. And of the stuff you do get, when you exit the while loop, you'll have only the last character you extracted from the file. You need to store that data somewhere.
Last edited on
Topic archived. No new replies allowed.