# C++ Programming

#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)

1. 👍 0
2. 👎 0
3. 👁 44
1. Just quickly looking...
if (nod = 4 < 6)
this will set nod true if 4 < 6.
Probably this is not what you mean.
To test for a range, you will have to separately test for the endpoints.
if( (nod >=4) && (nod <= 6) )
{
}
would test for nod greater or equal to 4 AND less than or equal to 6.

if( (nod >=4) && (nod < 6) )
{
}
would test for nod greater or equal to 4 AND less than 6.

There are a few other items, but I think the above will help you get started.

1. 👍 0
2. 👎 0

## Similar Questions

1. ### C++ Programming

#include #include #include int main ( ) { double noe, nod, dc1, dc2, dc3, dc4, t; cout > 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) {

asked by sonnytsn on April 9, 2008
2. ### Computer

on C++, I want to make an operation like " 2x + y - z ", I wrote something like that but I can' t get the result, where is my mistake? Ty. #include #include int main( void ) { char op; int x; int y; int z; int f; printf ("Enter

asked by Kaan on November 10, 2012
3. ### c++ program

how can a modfiy this source code to a menu. #include #include #include main() { char cYesNo = '\0'; int iResp1 = 0; int iResp2 = 0; int iResp3 = 0; int iElaspedTime = 0; int iCurrentTime = 0; int iRandomNum = 0; int i1 = 0; int

asked by kasey on October 24, 2011
4. ### Computer Science

Please suggest corrections to this code: why isn't the loop continuing ANY help is appreciated! #include #include using namespace std; int main () { double slope; int yint; int x; double cord; double coordinate(int x, double

asked by Olivia on October 23, 2017
5. ### computer sciece

#include #include int main() { int num[100]={0}; int i,n=0; for(i=0; num[i] != EOF ; i++,n++) { scanf("%d",&num[i]); } printf("%d\n", i); while(i=0;i

asked by Tracy on October 26, 2011
6. ### C++ Programming

I have to redo programming exercise 5 of chapter 9 using dynamic arrays. but I have the information but I don't know how to use it in a dynamic arrays please help. //Chapter 9: Programming Exercise 5 #include #include #include

asked by Chamell Williams on September 28, 2008
7. ### programming C++

Write a program that reads test scores up to 30 into an array. sentinel will stop when -1 is entered. Write functions that: 1. read the scores into arrays 2. computes the distribution based on whether they are As, Bs and so on 3.

asked by Erika on February 9, 2012
8. ### C++ Programming

Design and create a class named Stats that has an array of 12 doubles as one of its member variables. The values in the array should be set by making 12 calls to a public member function named setValue that accepts two arguments,

asked by kyuu09 on June 8, 2010
9. ### programming

Having trouble with this program running, can anybody help solve my problem: #include #include #include void draw_x(int width, int height); int main(int argc, char *argv[]){ int width, height; if(argc != 3){ printf("Syntax:

asked by Riley on February 8, 2010
10. ### C++

Would you check and correct my error please! ******************************* #include #include #include viod Binary_to_Decimal(); int main(int argv,char argc) { while(1

asked by Ayk on March 4, 2014

More Similar Questions