Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Undeclared identifier

Reply
Thread Tools

Undeclared identifier

 
 
John
Guest
Posts: n/a
 
      04-04-2006
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


 
Reply With Quote
 
 
 
 
Jaspreet
Guest
Posts: n/a
 
      04-04-2006

John wrote:
> 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 <iostream> instead of the deprecated <iostream.h> and so on..

> 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).

 
Reply With Quote
 
 
 
 
gangs
Guest
Posts: n/a
 
      04-04-2006
>> if (temp<150, temp>170)
>> if (pressure<60, pressure>70)
>> if (dwell<2, dwell>2.5)


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

gangs.

 
Reply With Quote
 
Jim Langston
Guest
Posts: n/a
 
      04-04-2006

"John" <> wrote in message
news:hxkYf.57791$...
>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?

> }
>
> 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
>
>



 
Reply With Quote
 
Jaspreet
Guest
Posts: n/a
 
      04-04-2006

gangs wrote:
> >> if (temp<150, temp>170)
> >> if (pressure<60, pressure>70)
> >> if (dwell<2, dwell>2.5)

>
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
identifier not found error, undeclared identifier aarthi28@gmail.com C++ 2 02-26-2007 02:11 AM
_asm NOP : undeclared identifier Saurabh Aggrawal C++ 3 12-10-2004 01:43 PM
Re: undeclared identifier? Victor Bazarov C++ 2 07-22-2003 01:33 PM
Re: undeclared identifier? John Dibling C++ 0 07-21-2003 08:40 PM
Re: undeclared identifier? Ron Natalie C++ 0 07-21-2003 08:38 PM



Advertisments