problem with my c++ project!!!

This is a discussion on problem with my c++ project!!! within the C++ Programming forums, part of the General Programming Boards category; Hi im new to programming. i couldnt solve the following problem. A plane is moving on x axis. For example ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    2

    problem with my c++ project!!!

    Hi
    im new to programming. i couldnt solve the following problem.
    A plane is moving on x axis.
    For example it moves to (5000,0) than (6000,0). I wrote a functions to calculates fuel.
    ....
    ....
    man->MinusX( man->GetX() ); ......1
    man->Setfuel( man->GetMinX()/man->GetHiz()*man->Getfuelconst() );.....2
    mane->Addfuel( man->Getfuel() ); .....3
    ...
    ...

    void Man:MinusX(float a){SetMinX(a - minx);}
    ...
    ...
    my problem is;if plane moves forward than backwards 2 dont calculates fuel correctly.
    I want to implant a simple solution bu i couldnt find it.


    Thanks.

  2. #2
    Registered User
    Join Date
    Jun 2004
    Posts
    124
    A few notes if you want help with your code.

    1) Use code tags that will make your code much easier to read.
    2) Tell us what your functions do. What is man, what is mane?

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,788
    Here's a hint:

    fabs
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    2
    Thanks.
    fabs() solved my problem.

    Now one thig left. Im using Dev-C++ and i couldnt find a way to enable Turkish encoding.
    The project is a console app. I tried to Visual Studio 2005 with the same project. I pu t header files to Headers directory and .cpp files to Source directory.
    After build it gives lots of errors:

    error C2653: 'Car' : is not a class or namespace name
    error C2065: 'fuel' : undeclared identifier
    error C3861: 'totalfuel: identifier not found
    .
    .
    .

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Erm... does it work WITHOUT "Turkish encoding"? It's hard for us to guess when you've posted errors and no code.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  2. How to add a file to a project in bloodshed.
    By Smeep in forum C++ Programming
    Replies: 4
    Last Post: 04-22-2005, 09:29 PM
  3. Project details: Dedicated
    By Stack Overflow in forum Projects and Job Recruitment
    Replies: 9
    Last Post: 02-22-2005, 02:10 PM
  4. Operating System Project
    By Pete in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 07-15-2004, 09:33 AM

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