| shagufa (5) | |
|
#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 ; } | |
|
|
|
| soranz (472) | |
|
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 | |
|
|
|
| shagufa (5) | |
|
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 | |
|
|
|
| Dash (122) | |
"cout" << 'pressure' << (0.19 + 9.45) << "psi";Why is cout enclosed in quotation marks ?
| |
|
|
|
| soranz (472) | |||
|
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:
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
|
|||
| shagufa (5) | |
| thank you ill work on it | |
|
|
|