This is in c++. I get the following errors: error: expression list treated as co
ID: 664271 • Letter: T
Question
This is in c++.
I get the following errors:
error: expression list treated as compound expression in functional cast (at for(int i=0;i<75;i++)
for(int j=0;j<21;j++)
What does it mean and how do I fix it?
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
int a;
int b;
float t1, t2, m, p2, p1, w, p, j, i,t;
double pt [75][21] = { . . . }
cout << "input temperature"<< endl;
cin >> t;
cout << "input pressure"<< endl;
cin >> p;
for int(i=0, i<21, i++)
for int (j=0, j<75, j++)
{
if pt[75][21]>=p
{
if pt>=
}
}
p1=aray[j-1][i];
x2=aray[j][i];
break;
}
}
cout<<"p1"<<p1;
cout<<"p2"<p2;
for(int i=0;i<75;i++)
for(int j=0;j<21;j++)
{
if(aray[i][j]>=t)
{
t1=aray[i][j-1];
t2=aray[i][j];
break;
}
}
cout<<"t1"<<t1;
cout<<"t2"<<t2;
m=(t2-t1)/(p2-p1);
cout.precision(4);
cout<<"The slope is: "<<m<<" ";
cin.get();
w=t1-(m*p1);
cout<<"the y interceptis: "<<w<<" ";
cout<<"the line equation is: y=("<<m<<")*p + "<<b<<" ";
system("pause");
}
if (p = 10)
a=3
}
...
b= (12+t)/3.4;
cout << "the answer is" << pt[a][b]<< endl;
return 0;
}
Thanks very much for your time and help!
Explanation / Answer
First of all The code is very unclear, You should try again with neater code,
There are lot of mistakes in your code like
1)or int(i=0, i<21, i++)
for int (j=0, j<75, j++)
it should have been
for (int i=0, i<21, i++)
for (int j=0, j<75, j++)
The int should be within bracket of FOR loop because you are defining variable i,j
2)
The brackets {} used in your codes are inconsistent, they are not properly placed, I can see you have used
more number of closed brackets "}" than open brackets "{"
3)
I am unable to provide correct code for the above because the above code in incomplete for eg.
if pt[75][21]>=p
{
if pt>=
}
What is "if pt>=" ?, please provide full code for better understanding.
I think if you correcty use brackets for your code then error will be removed
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.