Undeclared identifier

J

John

I keep getting "error C2065: 'p' : undeclared identifier" (it's the same for
t, d, t1, etc...), while using the following programming.

#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <iomanip.h>
#include <fstream.h>

int main()
{
fstream suture("SUTURE.dat", ios::in)
double temp;
double pressure;
double dwell;
suture >> batch >> temp >> pressure >> dwell;

double t;
double t1
if (temp<150, temp>170)
++t;
t1=(t*20);

double p;
double p1;
if (pressure<60, pressure>70)
++p;
p1=(p*20);

double d;
double d1;
if (dwell<2, dwell>2.5)
++d;
d1=(d*20);
}

I basically need to import the suture file and come up with rejection
percentages. As far as I can tell, I've identified everything with the
double floater. Any thoughts? TIA
 
J

Jaspreet

John said:
I keep getting "error C2065: 'p' : undeclared identifier" (it's the same for
t, d, t1, etc...), while using the following programming.

#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <iomanip.h>
#include <fstream.h>
why use so many headers ? I do think you may need all of them. Also
use said:
int main()
{
fstream suture("SUTURE.dat", ios::in)

No semicolon at the end of the statement..
double temp;
double pressure;
double dwell;
suture >> batch >> temp >> pressure >> dwell;

What is batch ??
double t;
double t1

No semicolon again..
if (temp<150, temp>170)
++t;
t1=(t*20);

double p;
double p1;
if (pressure<60, pressure>70)
++p;
p1=(p*20);

double d;
double d1;
if (dwell<2, dwell>2.5)
++d;
d1=(d*20);
}

I basically need to import the suture file and come up with rejection
percentages. As far as I can tell, I've identified everything with the
double floater. Any thoughts? TIA

Please post a correct copy of your code and let us know if you still
have the error(s).
 
J

Jim Langston

John said:
I keep getting "error C2065: 'p' : undeclared identifier" (it's the same
for
t, d, t1, etc...), while using the following programming.

#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <iomanip.h>
#include <fstream.h>

int main()
{
fstream suture("SUTURE.dat", ios::in)

need ; at end of line
double temp;
double pressure;
double dwell;
suture >> batch >> temp >> pressure >> dwell;

double t;
double t1
if (temp<150, temp>170)
++t;

t was never initialized. Value here is just about anything.
t1=(t*20);

since t is just about anything, t1 is just about anything times 20.
double p;
double p1;
if (pressure<60, pressure>70)
++p;
p1=(p*20);

Same here, p never initialized.
double d;
double d1;
if (dwell<2, dwell>2.5)
++d;
d1=(d*20);

Need I say it about d?
 
J

Jaspreet

gangs said:
what is the comma (,) doing in the if loop?

gangs.

If is not a loop. Loop is something which repeats itself a specified
number of time. if is a conditional statement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top