Need help with program. (please)

This is a discussion on Need help with program. (please) within the C++ Programming forums, part of the General Programming Boards category; Here is some code I wrote. I dont why its giving me these errors. C:\My Documents\programs\actual project for ie1.cpp(55) : ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    12

    Question Need help with program. (please)

    Here is some code I wrote. I dont why its giving me these errors.

    C:\My Documents\programs\actual project for ie1.cpp(55) : error C2064: term does not evaluate to a function
    C:\My Documents\programs\actual project for ie1.cpp(55) : error C2064: term does not evaluate to a function
    C:\My Documents\programs\actual project for ie1.cpp(55) : error C2064: term does not evaluate to a function
    C:\My Documents\programs\actual project for ie1.cpp(57) : error C2064: term does not evaluate to a function
    C:\My Documents\programs\actual project for ie1.cpp(57) : error C2064: term does not evaluate to a function
    C:\My Documents\programs\actual project for ie1.cpp(58) : error C2064: term does not evaluate to a function
    C:\My Documents\programs\actual project for ie1.cpp(58) : error C2064: term does not evaluate to a function
    C:\My Documents\programs\actual project for ie1.cpp(79) : error C2440: 'initializing' : cannot convert from 'class triangle *' to 'class main::$S15 *'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    C:\My Documents\programs\actual project for ie1.cpp(95) : error C2664: 'class istream &__thiscall istream::getline(char *,int,char)' : cannot convert parameter 3 from 'char [3]' to 'char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\programs\actual project for ie1.cpp(229) : error C2352: 'triangle::setvariables' : illegal call of non-static member function
    C:\My Documents\programs\actual project for ie1.cpp(31) : see declaration of 'setvariables'
    C:\My Documents\programs\actual project for ie1.cpp(232) : error C2582: 'main::$S15' : 'operator =' function is unavailable

    I cant get any of those errors fixed. Could someone help me. I'm sorry its so long but I didnt know what all you would need because I dont know whats wrong.

    Heres the code: (its long)

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

    //defining all of the forumulaes
    #define Base(bx,ax,by,ay,bz,az) sqrt(pow((bx-ax),2)+pow((by-ay),2)+pow((bz-az),2))
    #define Sde(ax,ay,az,cx,cy,cz) sqrt(pow((cx-ax),2)+pow((cy-ay),2)+pow((cz-az),2))
    #define SurfacArea(base,height) (base*height/2.0)
    #define AvgVertDist(az,bz,cz) ((az+bz+cz)/3.0)
    //going for arctan see if it works
    #define Pressure(fluidden,grav,vertdist,refpress) (-1.0)*(fluidden*grav*vertdist+refpress)
    #define TotalPressure(pres,surarea) (pres*surarea)
    #define Boyance(totalpressure,normy,normz) (totalpressure*normz/(sqrt(pow(normz,2)+pow(normy,2))))
    #define TotalBoyance(buoy) (totalboyance+=buoy)
    // defining total boyance as a global variable
    double totalboyance=0.0;
    float refpres,fluidden,grav;
    //that should be all the forumlaes now time for
    //some real programming
    //setting up the class triange, with variables
    //and a pointer to the next triangle.
    class triangle
    {
    public:
    triangle();
    ~triangle();
    setvariables(float);

    private:
    float ax,ay,az,bx,by,bz,cx,cy,cz;
    float normy,normz;
    float theta,refpress;
    float tax,tay,taz,tbx,tby,tbz,tcx,tcy,tcz;
    double base,side,surarea,height,buoy,totalpres,vertdist,p res;
    };

    triangle::setvariables(float refepress)
    {
    refpress=refepress;
    ax=tax;
    ay=tay;
    az=taz;
    bx=tbx;
    by=tby;
    bz=tbz;
    cx=tcx;
    cy=tcy;
    cz=tcz;
    base=Base(bx,ax,by,ay,bz,az);
    side=Sde(ax,ay,az,cx,cy,cz);
    height=(((bx-ax)(cx-ax)+(by-ay)(cy-ay)+(bz-az)(cz-az))/base);
    surarea=SurfacArea(base,height);
    normy=((-1.0)*((bx-ax)(cz-az)-(cx-ax)(bz-az)));
    normz=((-1.0)*((bx-ax)(cy-ay)-(cx-ax)(by-ay)));
    vertdist=AvgVertDist(az,bz,cz);
    pres=Pressure(fluidden,grav,vertdist,refpress);
    buoy=Boyance(totalpres,normy,normz);
    TotalBoyance(buoy);
    totalpres=TotalPressure(pres,surarea);
    }

    triangle::triangle()
    {
    }
    triangle::~triangle()
    {
    }



    int main ()
    {
    char units[8],unitout[8],test;
    float tax,tay,taz,tbx,tby,tbz,tcx,tcy,tcz;
    class *base=new triangle;
    float temp=0.0;


    //have to add the file name in
    ifstream a_file("test file.txt",ios::in);

    if(a_file.fail())
    {
    cout<<"The file didn't open successfully"<<endl;
    exit (1);
    }


    a_file.getline(units,8,"/n");
    // time to do the fun stuff

    for(;a_file.peek()!='/n';)
    {
    temp+=a_file.get();
    }
    a_file.get();
    const float refepress=temp;
    temp=0.0;
    for(;a_file.peek()!='/n';)
    {

    temp+=a_file.get();
    }
    a_file.get();
    const float fluidden=temp;
    temp=0.0;
    for(;a_file.peek()!='/n';)
    {
    temp+=a_file.get();
    }
    a_file.get();
    const float grav=temp;
    temp=0.0;
    for(;a_file.peek()!='/n';)
    {
    temp+=a_file.get();
    }
    a_file.get();
    const float depth=temp;
    temp=0.0;


    for(;!a_file.eof();) //if not end of file go in
    {

    tax=0.0,tay=0.0,taz=0.0,tbx=0.0,tby=0.0,tbz=0.0,tc x=0.0,tcy=0.0,tcz=0.0;
    //time to read in the text at the beginning of the file
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }

    else
    tax+=a_file.get();

    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    tay+=a_file.get();
    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    taz+=a_file.get();
    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    tbx+=a_file.get();
    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    tby+=a_file.get();
    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    tbz+=a_file.get();
    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    tcx+=a_file.get();
    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    tcy+=a_file.get();
    }
    a_file.get();
    for(; a_file.peek()!='/n';test=a_file.peek())
    {
    if (test=',')
    {
    break;
    }
    else
    tcz+=a_file.get();
    }
    triangle::setvariables(refepress);
    //once through time to reassign the current class and then repeat
    delete base.triangle::~triangle;
    *base=new triangle;
    }

    a_file.close();

    //output section
    cout<<"What would you like the boyancy force to be in (feet/meters)"<<endl;
    cin>>unitout;
    if (units==unitout)
    {
    if (units=="feet")
    {
    cout<<"The buoyancy force is "<<totalboyance<<" pounds";
    }
    else
    {
    cout<<"The buoyancy force is "<<totalboyance<<" newtons";
    }
    }
    else
    {
    if (units=="feet")
    {
    totalboyance*=4.448; //lbs to N
    cout<<"The buoyancy force is "<<totalboyance<<" pounds";
    }
    else
    {
    totalboyance/=4.448; // N to lbs
    cout<<"The buoyancy force is "<<totalboyance<<" newtons";
    }
    }


    return 0;
    }
    Last edited by curtner; 10-16-2001 at 04:48 PM.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    12
    the data file its refering to contains the following information.

    feet
    10.0
    1.0
    32.2
    5.0
    0.0,0.0,0.0
    1.0,0.0,0.0
    0.0,1.0,0.0
    1.0,0.0,0.0
    1.0,1.0,0.0
    0.0,1.0,0.0
    0.0,0.0,0.0
    0.0,0.0,1.0
    0.0,1.0,0.0
    0.0,0.0,1.0
    0.0,1.0,1.0
    0.0,1.0,0.0
    0.0,1.0,0.0
    1.0,1.0,0.0
    1.0,1.0,1.0
    1.0,1.0,1.0
    0.0,1.0,1.0
    0.0,1.0,0.0
    1.0,0.0,0.0
    1.0,0.0,1.0
    1.0,1.0,0.0
    1.0,0.0,1.0
    1.0,1.0,1.0
    1.0,1.0,0.0
    0.0,0.0,0.0
    1.0,0.0,0.0
    1.0,0.0,1.0
    0.0,0.0,0.0
    1.0,0.0,1.0
    0.0,0.0,1.0
    0.0,0.0,1.0
    1.0,0.0,1.0
    0.0,1.0,1.0
    1.0,0.0,1.0
    1.0,1.0,1.0
    0.0,1.0,1.0

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    12
    ok I figured them out. I forgot to include a "*" in the equations.

    in the getline it was '/n' instead of "/n".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21