O.K. I'm very very new to C++ but I am trying to make a programm that can do PV=nRT and for whatever you put 0 in for it solves the equation out. But when I was trying to test if I could get even one of the variables solved I came into a problem, it's not giving me the right answer XD.
Here is my script
Code:#include <iostream> using namespace std; int main() { int P; float V; float r; float n; float temp; float answer; cout<<"Please enter value for Pressure in kPa \n"; cin>> P; cin.ignore (); cout<<"Please enter value for Volume in L \n"; cin>> V; cin.ignore (); cout<<"Please enter value for n in moles \n"; cin>> n; cin.ignore (); cout<<"Please enter value for Temperature in Celsius \n"; cin>> temp; cin.ignore (); r = 8.31; if ( P = 0 ) { answer = n * r * temp / V; } cout<<answer; cin.ignore(); cin.get (); }