#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) && (nod <6) ) {
goto 2;
}
else
}
{
if ( (nod >6) && (nod <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);
}

A few things to check:

The first test is true for any number greater than 4. If you enter 5, the first test will go to label 1. Maybe the first test should be less than 4.
Another item to check:
You are not including the endpoints in the range check.
From your code:
if ( (nod >4) && (nod <6) ) {
goto 2;
}
else
}
{
if ( (nod >6) && (nod <11) )
}
goto 3;
---------------
If you enter 6, it will not satisfy either of these.

i did that. it still doesn't work :*(

thanks for your help but can you try compliaing it?

Does it compile OK?

If so, what is the test input that is failing?

Looking again:

Labels cannot begin with a number.
1: is wrong
L1: would be OK
Try changing your labels ( and goto's).

Your braces are backwards after your "else"

should be:
else {
}

Your 3rd and 4th "if" statements have backward braces also.

it says it has a unidentifair berfore numberic constant

OK,

Post the code you just tried.
Also, which line is the compiler complaining about?

still doesn't work :(

how do you convert 2 for binary to decimal using c++ program

This code is written in C++ and calculates the cost of eggs based on the number of eggs entered by the user. Here's how the program works:

1. The program starts by declaring the necessary variables: noe (number of eggs), nod (number of dozens), dc1, dc2, dc3, dc4 (discount rates for different ranges), and t (total cost).

2. The program then prompts the user to enter the number of eggs using the 'cout' statement and reads the input using the 'cin' statement.

3. The code calculates the number of dozens (nod) by dividing the number of eggs (noe) by 12.

4. Next, the program assigns different discount rates (dc1, dc2, dc3, dc4) based on the number of dozens (nod). These discount rates are pre-calculated and stored as variables.

5. The 'cout.setf(ios::fixed)' statement sets the floating-point output format to fixed decimal notation.

6. The 'cout.precision(3)' statement sets the precision of the floating-point output to 3 decimal places.

7. The code then checks the value of nod using if-else statements.

8. If the value of nod is greater than 4, the program goes to label '1'. This label is defined later in the code.

9. If the value of nod is between 4 and 6 (both exclusive), the program goes to label '2'.

10. If the value of nod is greater than 6 and less than 11, the program goes to label '3'.

11. If the value of nod is greater than 11, the program goes to label '4'.

12. The labels '1', '2', '3', and '4' define the sections of code that calculate the cost of eggs based on the discount rates.

13. Inside each label, the code calculates the total cost (t) by multiplying the number of eggs (noe) with the corresponding discount rate (dc1, dc2, dc3, dc4).

14. The program then prints the cost per dozen or per egg using 'cout' statements.

15. The 'goto end;' statement jumps to the end of the code to skip the execution of the remaining labels.

16. The code also contains a 'system("Pause")' statement, which pauses the console output so that the results can be seen before the program exits.

17. Finally, the program returns 0 to indicate successful execution.

This code can be compiled and executed to calculate the cost of eggs based on the number of eggs entered by the user.