Undeclared identifier

Discussion in 'C++' started by John, Apr 4, 2006.

  1. John

    John Guest

    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
     
    John, Apr 4, 2006
    #1
    1. Advertising

  2. John

    Jaspreet Guest

    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).
     
    Jaspreet, Apr 4, 2006
    #2
    1. Advertising

  3. John

    gangs Guest

    >> 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.
     
    gangs, Apr 4, 2006
    #3
  4. John

    Jim Langston Guest

    "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
    >
    >
     
    Jim Langston, Apr 4, 2006
    #4
  5. John

    Jaspreet Guest

    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.
     
    Jaspreet, Apr 4, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ron Natalie

    Re: undeclared identifier?

    Ron Natalie, Jul 21, 2003, in forum: C++
    Replies:
    0
    Views:
    424
    Ron Natalie
    Jul 21, 2003
  2. Victor Bazarov

    Re: undeclared identifier?

    Victor Bazarov, Jul 21, 2003, in forum: C++
    Replies:
    2
    Views:
    2,643
    rajiv04
    Jul 22, 2003
  3. John Dibling

    Re: undeclared identifier?

    John Dibling, Jul 21, 2003, in forum: C++
    Replies:
    0
    Views:
    415
    John Dibling
    Jul 21, 2003
  4. Saurabh Aggrawal

    _asm NOP : undeclared identifier

    Saurabh Aggrawal, Dec 10, 2004, in forum: C++
    Replies:
    3
    Views:
    3,588
    Thomas Matthews
    Dec 10, 2004
  5. Replies:
    2
    Views:
    1,782
Loading...

Share This Page