dnt nw what i am doing wrong

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
// The value of pressure in pounds per square inch of a wareform;
const double Time= 35;
int t,psi;

cout << " nEnter time by user:";
if
(time <= 35);

"pressure" 0.46 t psi;

else
(time >= 35)
pressure is 0.19 t + 9.45 psi;

count << "The pressure in psi and time in t" << pressure << endl;

return 0 ;
}
use [/CODE] tags pls.

there's lots of brackets missing...look up how to do control statements in C++
'else' isn't used that way

'count' is probably a typo..

makes no sense:
pressure is 0.19 t + 9.45 psi;
maybe u want this?
pressure = 0.19 * t + 9.45 * psi;
but that doesn't matter much because psi and t are not initialized...
look up 'cin' which is 'cout's best friend XD
thank u soranz i tried the other way is this correct but the only 1 error is showing up is the 19 expected `;' before string constant what shall i do
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
// The value of pressure in pounds per square inch of a wareform;
const double Time= 35;
int t,psi;

cout << " nEnter time by user:";
{
if (t <= 35)
cout << 'pressure' << (0.46) << "psi";
}
{

(t >= 35)
"cout" << 'pressure' << (0.19 + 9.45) << "psi";
}
cout << "The pressure in psi and time in t" << pressure << endl;

system("PAUSE");
return 0 ;
i hope u can help me with this. plis
"cout" << 'pressure' << (0.19 + 9.45) << "psi";

Why is cout enclosed in quotation marks ?
If this compiles u should trash ur compiler...
I'm just going to point to things that need to be fixed...
First, codetags like so:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
       //dont need ; in comments
   // The value of pressure in pounds per square inch of a wareform; 
   const double Time= 35;
   int t,psi;

   cout << " nEnter time by user:"; //'n' wont produce a newline by itself. it needs the escape character...
   {  //is cout a control statement ? 
      if (t <= 35) //yes, 'if' is a control statement
      //this isn't how 'cout' works...and is not even consistent with the other one
      cout << 'pressure' << (0.46) << "psi";  //this is the only line that will be executed when the condition is met

   }
   {  //brackets control the flow but there's nothing to control this block of code
     //so it will always execute - making the bracket redundant...

      (t >= 35) //what is the purpose of this ?
      "cout" << 'pressure' << (0.19 + 9.45) << "psi"; //how is cout used ?
   } //and this one too
   //this is a good cout tho u might want an extra space after 't' for readability
   cout << "The pressure in psi and time in t" << pressure << endl;

system("PAUSE"); 
return 0 ; //good end
//what's missing here ? 

It looks like u also want to add functionality for user input. This can be accomplished with 'cin'. Where cout prints things out to the screen, cin takes inputs from a user which can be stored, manipulated and then printed out to the screen again using cout.
Last edited on
thank you ill work on it
Topic archived. No new replies allowed.