So the main problem that i encounter is, i don't know what the text file format should be so it can read another data from another supplier |
Do you mean you want to list the same product from 2 suppliers? Such as, Tiles can come from, for instance, FloorToGo and Jebsen? In that case, just have 2 lines in your data file for Tiles.
Tiles FloorToGo Hans 09351864545 |
Tiles Jebsen RA 09564875560 |
ToiletPartition Jebsen RA 09564875560 |
Lockset Dorma Steve 09546556123 |
Tiles Itrade Sandy 09224568916 |
also is it possible to have a scope with multiple suppliers |
I guess I answered that above.
The code you posted merely checks the first entry in the file. If it matches the scope, it prints out the values. Note that playagain is not initialized at this point.
If the scope does not match, the program asks if you want to play again and takes an int as input. I'll assume you enter an int (because you are not handling erroneous input at all).
At this point, if the playagain value happened to be initialized to 1 (if first line contained your scope) or if the user entered 1 (if the first line did not contain your scope), the program loops up and asks for a new scope.
At NO TIME does you program look at anything beyond the first line of your file. You are not looping through the lines of the file. If you want to print out all suppliers for a specific scope, loop through the entire file and print out all entries that match what you want.