fgets works with C FILE*s so my first question is are you trying to write this in C or C++?
- Why do you have two indexes i and j, when you have only a 1D array? (note: j will always be i+1)
- Same question goes for your pair of while loops.
- What exactly are you trying to do here?
PS: You need to declare i and j as ints, but I'll assume you just omitted that part...
I want to have an input that reads in a "rule" in array 0 and then the expansion of that rule in array 1
they would be sort of pair cause i need to relate the rule to the expansion later on.
example: rule[0] = F
rule[1] = F + f
and this goes on with more rules so i was thinking the rules could be even numbers while the expansion could be odd numbers.
i dont think i have an example file but i'll try to explain the logic
I'm asked to put in sets of "rules" that comes in two lines. How it's supposed to go is that i have to type in the first line which is one letter. the next line would be sort of what the letter would expand to.
example:
F
F+F
a
c+b
so as you can see
F would represent the string F+F
while a is the string c+b
this would be later used when i type in a string such as "F+aF" which is supposed to use the rules to expand itself. i hope i explained it well enough.