then i tried running it (plus found some missign brackets :-d) and it will only follow the forumla for finding pressureOne. It's like the program is ignoring the statement if (problem == "pressureOne") and continues to follow the code as if i were solving for pressureOne no matter what.

Code:

//INCLUDE FILES
#include <iostream>
#include <cmath>
#include <string>
#include <conio.h>
using namespace std;
//Main function
int main ()
{
string problem;
cout << "Solving for pressureOne, pressureTwo, volumeOne, volumeTwo?: ";
cin >> problem;
//SOLVING FOR pressureOne
if (problem == "pressureOne");
double pressureTwo, volumeOne, volumeTwo, answerOne;
{
cout << "PressureTwo: ";
cin >> pressureTwo;
cout << "VolumeOne: ";
cin >> volumeOne;
cout << "VolumeTwo: ";
cin >> volumeTwo;
answerOne = (pressureTwo * volumeTwo) / volumeOne;
cout << "The answer is: " << answerOne;
getche ();
return 0;
}
//SOLVING FOR pressureTwo
if (problem == "pressureTwo");
{
double pressureOne, volumeOne, volumeTwo, answerTwo;
cout << "PressureOne: ";
cin >> pressureOne;
cout << "VolumeOne: ";
cin >> volumeOne;
cout << "VolumeTwo: ";
cin >> volumeTwo;
answerTwo = (pressureOne * volumeOne) / volumeTwo;
cout << "The answer is: " << answerTwo;
getche ();
return 0;
}
//SOLVING FOR volumeOne
if (problem == "volumeOne");
{
double pressureOne, pressureTwo, volumeTwo, answerThree;
cout << "PressureOne: ";
cin >> pressureOne;
cout << "PressureTwo: ";
cin >> pressureTwo;
cout << "VolumeTwo: ";
cin >> volumeTwo;
answerThree = (pressureTwo * volumeTwo) / pressureOne;
cout << "The answer is: " << answerThree;
getche ();
return 0;
}
//SOLVING FOR volumeTwo
if (problem == "volumeTwo");
{
double pressureOne, pressureTwo, volumeOne, answerFour;
cout << "PressureOne: ";
cin >> pressureOne;
cout << "PressureTwo: ";
cin >> pressureTwo;
cout << "VolumeOne: ";
cin >> volumeOne;
answerFour = (pressureOne * volumeOne) / pressureTwo;
cout << "The answer is: " << answerFour;
getche ();
return 0;
}
}

And to malbuc87uk, if i do that, i get the same error just more times. I think ill just leave out the else statement for now, but what i cant understand is why when i run the program it solves as if i told it problem == pressureOne no matter what. I even ran a little test, in which after i told it what problem equaled, to display problem, by doign this:

Code:

string problem;
cout << "Solving for pressureOne, pressureTwo, volumeOne, volumeTwo?: ";
cin >> problem;
cout << problem;

and that worked. If i told the program i was solving for pressureTwo it would display, pressureTwo. So obviously it knows what the variable problem is. It's just completly ignoring my if statements, and just solvign for pressureOne no matter what.