Seneca BTP 305
Read Function
Lab 1The next function we need to create is read. Go back and review the lab instructions to understand what this function is expected to do.
The lab states that each line in the input file will follow this format:
<Customer Name>,<Order Description>,<Price>,<Daily Special Status>[newline]This means each field is separated by a comma, and each order ends with a newline character.
Prototype
Inside your FoodOrder.h file, add the following prototype inside the public section:
void read(std::istream &is);Source
Now open your FoodOrder.cpp file and begin writing the function implementation. At the top of the file, make sure you have:
using namespace std;This allows you to use istream and other standard objects without prefixing them with std::.
Members only
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 17 more lessons in Seneca BTP 305.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.