Hi guys I need help with some pseudocode and I already have some lines I think.
Write a program that prompts the user to enter an item#, the program should determine if the item is in the file and print the price of the corresponding item. If the item is not in the file an error message should be printed.
Starting from where you left off...(it's up to you to make sure what you got is correct)
Take a look at this and see if it makes sense.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// pseudocode
bool bItemFound = FALSE; // assuming some sort of boolean flag to keep track of item being 'found' or not
while ( (getline has not hit EOF) OR (bItemFound is equal to FALSE) )
{
if (item is found in the current line)
{
get item information from current line
set bItemFound to TRUE
}
}
// if bItemFound is still FALSE, while-loop completed file parsing
// and didn't find the item in any of the lines. . .
if (bItemFound is FALSE)
{
print out error
}