Not sure of your exact problem becuase you really didnt specify.
But i ran the program a few times and found the error in your exit statement. So take a look at the last line, becuase your exit portion didnt exit until it asked you for distance.
Code:
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <windows.h>
#include <time.h>
#define sleep Sleep
int main(void)
{
float grav = 9.80;
float mass, acceleration,weight,mew, time,finalvelocity,initialvelocity, speed,gravity, force, torque, forcen, friction, forcep, distance, mass2;
int poop;
int butt;
int finger;
int me;
while(poop)
{
Sleep(2000);
{
int i;
for (i = 0; i < 50; i++)
putchar ('\n');
cout<<endl<<"What would you like to find?"<<endl;
cout<<"(1) Acceleration or Speed"<<endl;
cout<<"(2) Weight or Fw "<<endl;
cout<<"(3) Mass "<<endl;
cout<<"(4) Force "<<endl;
cout<<"(5) Mew and the forces of friction "<<endl;
cout<<"(6) Exit the program"<<endl;
cout<<":";
cin>>poop;
}
{
int i;
for (i = 0; i < 50; i++)
putchar ('\n');
if (poop == 1)
{
cout<<"Which would you like to find?"<<endl;
cout<<"(1) Acceleration "<<endl;
cout<<"(2) Speed "<<endl;
cout<<":";
cin>>butt;
if (butt == 1)
{
cout<<"What is the final velocity in m/s?:";
cin>>finalvelocity;
cout<<endl<<"What is the intial velocity in m/s?:";
cin>>initialvelocity;
cout<<endl<<"What is the elapsed time in seconds?:";
cin>>time;
acceleration = (finalvelocity - initialvelocity)/time;
cout<<"The acceleration is : "<<acceleration;
cout<<" m/s^2"<<endl;
}
}
if (butt == 2)
{
cout<<"Enter the total distance : ";
cin>>distance;
cout<<endl<<"Enter the total time : ";
cin>>time;
speed = distance/time;
cout<<"The speed is : "<<speed;
cout<<" m/s"<<endl;
}
if (poop == 2)
{
cout<<"What is the mass in kilograms?:";
cin>>mass;
weight = mass * grav;
cout<<"The weight in Newtons is: "<<weight<<endl;
}
if (poop == 3)
{
cout<<"What is the weight in newtons?:";
cin>>weight;
mass = weight / grav;
cout<<"The mass of the object in kilograms is: "<<mass<<endl;
}
if (poop == 4)
{
cout<<"Which would you like to do?"<<endl;
cout<<"(1) Force and acceleration on bodies of known weight Force = Fw*a/g"<<endl;
cout<<"(2) Newton's second law of motion Force = ma"<<endl;
cout<<"(3) Law of universal gravitation Force = G*m1*m2/(d)^2"<<endl;
cout<<":";
cin>>finger;
if (finger == 1)
{
cout<<"Enter the weight (Fw):";
cin>>weight;
cout<<endl<<"Enter the acceleration :";
cin>>acceleration;
cout<<endl<<"Enter the force of gravity :";
cin>>gravity;
force = weight*acceleration/gravity;
cout<<"The force is "<<force;
cout<<" newtons"<<endl<<endl<<endl;
}
if(finger == 2)
{
cout<<"Enter the mass :";
cin>>mass;
cout<<endl<<"Enter the acceleration :";
cin>>gravity;
force = mass*acceleration;
cout<<"The force is "<<force;
cout<<" newtowns"<<endl<<endl<<endl;
}
if(finger == 3)
{
cout<<"Enter the gravitational constant :";
cin>>gravity;
cout<<endl<<"Enter the mass of the first body :";
cin>>mass;
cout<<endl<<"Enter the mass of the second body :";
cin>>mass2;
cout<<endl<<"Enter the distance between their centers of mass :";
cin>>distance;
cout<<endl<<endl;
force = gravity*(mass*mass2)/(distance*distance);
cout<<endl<<"The force is "<<force;
cout<<" newtons";
cout<<endl<<endl;
}
}
if (poop == 5)
{
cout<<endl<<"What would you like to do?"<<endl;
cout<<"(1) Find Mew (the coefficient of friction)"<<endl;
cout<<"(2) Find the force of friction "<<endl;
cout<<"(3) Find the normal force "<<endl;
cout<<"(4) dummie"<<endl;
cout<<":";
cin>>me;
if(me == 1)
{
cout<<endl<<"Enter the force of friction :";
cin>>friction;
cout<<endl<<"Enter the normal force :";
cin>>forcen;
mew = friction/forcen;
cout<<endl<<"The coefficient of friction is "<<mew<<endl<<endl;
}
if(me == 2)
{
cout<<endl<<"Enter the coefficient of friction :";
cin>>mew;
cout<<endl<<"Enter the normal force :";
cin>>forcen;
friction = mew*forcen;
cout<<endl<<"The frictional force is "<<friction<<endl<<endl;
}
if(me == 3)
{
cout<<endl<<"Enter the frictional force :";
cin>>friction;
cout<<endl<<"Enter the coefficient of friction :";
cin>>mew;
forcen = friction/mew;
cout<<endl<<"The normal force is "<<forcen;
cout<<" newtons";/*right here it should display the answer, clear the screen then loop
back to the main option menu, but for some reason it displays the answer
when the main menu is looped back*/
}
if(me == 4)
{
cout<<endl<<"you are a dummie!!!";
}
}
if(poop == 6)
{
exit(0); //// I CHANGED THIS
}
}
}
}
If you notice i changed
Code:
if(poop == 6)
{
break;
}
to this
Code:
(poop == 6)
{
exit(0); //// I CHANGED THIS
}
NOTE: To make this much more easier for people to read your code, use different names instaed of POOP and FINGER AND BUTT.