how to do this?

i'm a beginner and need some help.

28. Convert the following pseudocode to C++ code. Be sure to define the appropriate variables.

Store 172.5 in the force variable.
Store 27.5 in the area variable.
Divide area by force and store the result in the pressure variable.
Display the contents of the pressure variable.

if anyone can teach one of the steps would be great.

thanks.
It is better if you had some code written and posted so we can help you out. Don't expect anyone doing homework problems you.

Now, if you want to store 172.5 into the force variable, you first need to declare the variable then set it equal to 172.5:

 
double force = 172.5;


This should get you started on the problem.
Last edited on
1
2
3
4
5
6
7
8
9
10
{
  double force = 172.5 
  double area  = 27.2 
  27.2/172.5
  double pressure = 
  // Display the content.
  cout << "The content is: " << content << endl;
  return 0;
}
 


this is the part im stuck at.

Divide area by force and store the result in the pressure variable.

any help?
Last edited on
The force variable is currently storing nothing while 27.2/172.5 belong to no variable. You should get an error for that. So solve this problem all you have to do is set pressure = area / force.
Like this :
 
double pressure = area / force;
ok thanks. for display the contents of the pressure variable, am I doing it right?
@noobneedhelp your output is correct.
Topic archived. No new replies allowed.