Thursday
November 27, 2014

Homework Help: C++ Programming

Posted by sonnytsn on Tuesday, April 8, 2008 at 5:58am.

#include <iostream.h>
#include <stdlib.h>
#include <math.h>

int main ( )
{
double noe, nod, dc1, dc2, dc3, dc4, t;
cout << "Enter number of eggs: ";
cin >> noe;
nod = noe / 12;
dc1 = .50 / 12;
dc2 = .45 / 12;
dc3 = .40 / 12;
dc4 = .35 / 12;
cout.setf(ios::fixed);
cout.precision(3);
if (nod > 4) {
goto 1;
}
if (nod = 4 < 6) {
goto 2;
}
else
}
{
if (nod = 6 < 11)
}
goto 3;
{
else
}
{
if (nod > 11)
}
goto 4;
{
else
}
{
1:
t = noe * dc1;
cout << "Your cost is $0.50 per dozen or " << dc1 << " per egg.";
cout << endl;
goto end;
2:
t = noe * dc2;
cout << "Your cost is $0.45 per dozen or " << dc2 << " per egg.";
goto end;
3:
t = noe * dc3;
cout << "Your cost is $0.40 per dozen or " << dc3 << " per egg.";
goto end;
4:
t = noe * dc4;
cout << "Your cost is $0.35 per dozen or " << dc4 << " per egg.";
cout.setf(ios::fixed);
cout.precision(2);
cout << "Your bill comes to " << t;
cout << endl;
cout << endl;
system("Pause");
return (0);
}





If you can fix this i'll be forever greatful! i've been up for about 2 hours trying to figure it out!

Note (the goto commands weren't originally their, i thought it would work but it didn't)

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

C++ Programming - #include <iostream.h> #include <stdlib.h> #include...
C++ Programming - I have to redo programming exercise 5 of chapter 9 using ...
C++ - Would you check and correct my error please...
C++ Programming - I NEED HELP WITH MY CODE!!! it won't compile right The formula...
C++ - #include <iostream.h> #include <stdlib.h> int main ( ) { int ...
programming C++ - Write a program that reads test scores up to 30 into an array...
C++ if else problem, please look - It compiles but it doesn't work. can you tell...
C++ - #include <iostream.h> #include <stdlib.h> int main ( ) { int ...
C++ - I have no idea how to construct this program. Any help is appreciated. ...
C++ Programming - Design and create a class named Stats that has an array of 12 ...

Search
Members