Can someone help me please?
I have to do this turkey project, everything is working ok, exept for my oven time.
when it prints this line:
cout << "Put the turkey in the oven on the " << startThawDay + howLongToThaw <<"th " << " at " << ovenTime <<" o`clock." << endl;
the ovenTime is never right, I can`t find out where it`s wrong.
this is the whole code
#include<iostream>
#include<iomanip>
#include<string>
using std::setprecision;
using std::cout;
using std::cin;
using std::endl;
using std::fixed;
using std::string;
double turkey();
int sweetPotatoes();
int pies();
//int thanksgivingTime(int turkeyTotalDays);
int main()
{
//int turkeyTotalDays;
cout << "This program will help you get your food ready thanksgiving dinner on time. " << endl << endl;
turkey();
sweetPotatoes();
pies();
cout << "Your dinner will be all ready at 2pm on thanksgiving day if you follow these instructions.";
cout << endl << endl << "Happy Thanksgiving!" << endl;
//thanksgivingTime(turkeyTotalDays);
return 0;
}
double turkey()
{
int day = 26;
int hour = 14;
int min = 00;
double weightOfTurkey;
int thawTime;
int cookTime;
int turkeyTotal;
int turkeyTotalDays;
int turkeyHour;
int startThawDay;
int howLongToThaw;
int ovenTime;
string standardTime;
string am = "am";
string pm = "pm";
cout << "Enter the weight of you turkey in lbs: ";
cin >> weightOfTurkey;
thawTime = weightOfTurkey * 6;
cookTime = (weightOfTurkey / 3) * .75;
turkeyTotal = (((thawTime + cookTime)* 60)+20)/60;
turkeyTotalDays = turkeyTotal / 24;
turkeyHour = turkeyTotal % 24;
startThawDay = day - turkeyTotalDays;
hour = hour - turkeyHour;
howLongToThaw = thawTime / 24;
ovenTime = hour - cookTime;
ovenTime = (ovenTime == 0 || ovenTime == 12)?12 : ovenTime %12;
standardTime = (hour < 12) ?am : pm;
hour = (hour ==0 || hour == 12)?12 : hour %12;
if (turkeyHour > 0)
{
if( turkeyTotalDays > 1 )
{
cout << "It will take " << turkeyTotalDays << " days, and " << turkeyHour
<< " hours for the turkey to be ready." << endl;
}
else if (turkeyTotalDays == 0)
cout << "It will take " << turkeyHour << " hours for the turkey to be ready." << endl;
else
cout << "It will take " << turkeyTotalDays << " day, and " << turkeyHour
<< " hours for the turkey to be ready." << endl;
cout << "Start thawing the turkey on the " << startThawDay <<"th at "<< hour <<
standardTime << "." << endl;
}
if (turkeyHour == 0)
{
if( turkeyTotalDays > 1 )
{
cout << "It will take " << turkeyTotalDays << " days." << endl;
}
else
cout << "It will take " << turkeyTotalDays << " day." << endl;
cout << "Start thawing the turkey on the " << startThawDay <<"th at 2pm."<<endl;
}
cout << "Put the turkey in the oven on the " << startThawDay + howLongToThaw
<<"th " << " at " << ovenTime <<" o`clock." << endl;
return 0;
}
int sweetPotatoes()
{
int totalPotatoeTime;
totalPotatoeTime = 10 + 30;
cout << "The sweet potatoes take " << totalPotatoeTime << " minutes to be ready." << endl;
cout << "Put the sweet potatoes in the oven at 1:20pm on thanksgiving day.";
cout << endl;
return 0;
}
int pies()
{
cout << "Put the apple pie in the oven at 1:00pm, and the pumpking pie " <<
"at 1:15pm on thanksgiving day." << endl;
return 0;
}
thanks