Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I keep getting an error with my solution because I cant use strtof in visual stu

ID: 3567843 • Letter: I

Question

I keep getting an error with my solution because I cant use strtof in visual studio due to not being supported. Is there anything i can use to replace strtof in visual studio to run this program.

this is the original question with my solution.

Please help. The following two question(number 4 and 5) should be combine into one solution that reads the input text file Ch9_Ex4Data.txt. The input text file is Plain Egg
1.45
Bacon and Egg
2.45
Muffin
0.99
French Toast
1.99
Fruit Basket
2.49
Cereal
0.69
Coffee
0.50
Tea
0.75.

Question 4. Write a program to help a local restaurant automate its breakfast billing
system. The program should do the following:

a. Show the customer the different breakfast items offered by the restaurant.

b. Allow the customer to select more than one item from the menu.

c. Calculate and print the bill.
Assume that the restaurant offers the following breakfast items (the price
of each item is shown to the right of the item):

Plain Egg $1.45
Bacon and Egg $2.45
Muffin $0.99
French Toast $1.99
Fruit Basket $2.49
Cereal $0.69
Coffee $0.50
Tea $0.75
Your program must contain at least the
following functions:

Explanation / Answer

#include <iostream>
#include <fstream>
#include <cstring>
#include <string>
using namespace std;
struct menuItem
{
string item;
float price;
int quantity;
};
menuItem* breakfastMenu = new menuItem[8];

void getData()
{
ifstream myfile ("Ch9_Ex4Data.txt");
if (myfile.is_open())
{
string line;
int i=0,flag=1;
while ( getline (myfile,line) )
{
if(flag){
breakfastMenu[i].item = line;
flag=0;
}
else{
   breakfastMenu[i++].price = atof(line.c_str());
flag=1;
}
}
}
else cout << "Unable to open file";
myfile.close();
}
void printCheck()
{
float billAmount;
for(int i=0;i<8;i++)
{
   if(breakfastMenu[i].quantity > 0)
   {
       billAmount += breakfastMenu[i].quantity * breakfastMenu[i].price; //cout statement can't output assignement
       cout<<billAmount<<endl;
   }
}
cout<<"Amount Due $"<< billAmount<<endl;
}

void showMenu()
{
int num,quantity;
char c;
for(int i=0;i<8;i++)
cout<<(i+1) <<". " < cout<<"What would you like to have?";
cin>>num;
cout<<"Quantity?"< cin>>quantity;
breakfastMenu[num-1].quantity = quantity;
cout<<"Print check?(y/n)"< cin>> c;
if(c=='Y' || c=='y')
printCheck();
else
showMenu();
}


int main()
{
getData();
showMenu();
system("pause");
return 0;
}