Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use c++ and this File: #include #include #include using namespace std; //Define a data structure named NutritionData const int NAME_SIZE = 40; struct NutritionData {
Use c++ and this File:
#include
#include
#include
using namespace std;
//Define a data structure named NutritionData
const int NAME_SIZE = 40;
struct NutritionData {
char foodName[NAME_SIZE];
double servingSize;
double calFromCarb;
double calFromFat;
double calFromProtein;
};
bool retrieveNutritionData(const string &fileName,
NutritionData *dataPtr,
int recordNum);
void printNutritionData(const NutritionData *dataPtr);
int main() {
string filename = "nutri.dat";
// Write your code here . . .
return 0;
}
bool retrieveNutritionData(const string &fileName,
NutritionData *dataPtr,
int recordNum) {
bool result {false};
// Write your code here . . .
return result;
}
//***********************************************************************
//* Definition of the function that can print a nutrition data.
//* The function calculates the total calories per serving by
//* adding the calories from three nutrition components.
void printNutritionData(const NutritionData *dataPtr) {
// Write you code here . . .
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started