asking this question for the second time, the code must give you the corresponding price when you enter an alphabet, then give you -1 if the alphabet is not on the table, it must be in C++ language Eg: Input : a Output: R5.50 Eg: Input: p Output: -1 Write a program that displays the cost of different options at a vending machine. Your program must: • read in a selection char from a file called input.txt, • use case statements to select the price linked to the input char, • write the price corresponding to the char to a file called output.txt. • If the char is not present in the file write -1 to the file. You should account for all items as listed in Table 4 as well as invalid selections (those not listed in table 4).
Im asking this question for the second time, the code must give you the corresponding price when you enter an alphabet, then give you -1 if the alphabet is not on the table, it must be in C++ language
Eg: Input : a
Output: R5.50
Eg: Input: p
Output: -1
Write a
must:
• read in a selection char from a file called input.txt,
• use case statements to select the price linked to the input char,
• write the price corresponding to the char to a file called output.txt.
• If the char is not present in the file write -1 to the file.
You should account for all items as listed in Table 4 as well as invalid selections (those not listed
in table 4).
Product | Selection char | Cost |
Cheese naks | a | R5.50 |
Doritos | b | R7.50 |
Coke | c | R12.50 |
Chappie | d | R2.00 |
Tex | e | R8.00 |
Bar-one | f | R7.00 |
Step by step
Solved in 2 steps