Closed Thread
Results 1 to 6 of 6

Thread: need help with a small program

  1. #1
    scott0999 is offline Newbie
    Join Date
    Feb 2007
    Posts
    3
    Rep Power
    0

    need help with a small program

    im trying to make a small program to calculate fuel

    it would have something where you enter the BLM (a number) and the VE (the original fuel number) and it would calculate the new VE. the BLM is supposed to be 128 so when its off I would have to calculate it all manually otherwise.

    so the equation would look like this:

    BLM/128 = X * VE = new VE

    but if the BLM was above 128 it would have to add to the VE, if it was below it would subtract.

    can anyone help?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Deathcry's Avatar
    Deathcry is offline Learning Programmer
    Join Date
    Feb 2007
    Posts
    69
    Rep Power
    0
    Quote Originally Posted by scott0999 View Post
    im trying to make a small program to calculate fuel

    it would have something where you enter the BLM (a number) and the VE (the original fuel number) and it would calculate the new VE. the BLM is supposed to be 128 so when its off I would have to calculate it all manually otherwise.

    so the equation would look like this:

    BLM/128 = X * VE = new VE

    but if the BLM was above 128 it would have to add to the VE, if it was below it would subtract.

    can anyone help?
    .....
    BLM/128 = X; // are you dividing the blm by 128 or is that what blm equals?
    X * VE = new_VE;

    if ( BLM < 128 ) {
    new_VE - BLM;
    cout << new_VE;
    }
    else if ( BLM > 128 ) {
    new_VE + BLM;
    cout << new_VE;
    }

    I dont think i totally understand your question but what i think u meant i left some code for. could you specify more.. do you have any sample code?
    Last edited by Deathcry; 02-28-2007 at 08:25 PM.
    the code is with you

  4. #3
    Deathcry's Avatar
    Deathcry is offline Learning Programmer
    Join Date
    Feb 2007
    Posts
    69
    Rep Power
    0
    If admin could just delete this. posted it on accident
    the code is with you

  5. #4
    scott0999 is offline Newbie
    Join Date
    Feb 2007
    Posts
    3
    Rep Power
    0
    Quote Originally Posted by Deathcry View Post
    .....
    BLM/128 = X; // are you dividing the blm by 128 or is that what blm equals?
    X * VE = new_VE;

    if ( BLM < 128 ) {
    new_VE - BLM;
    cout << new_VE;
    }
    else if ( BLM > 128 ) {
    new_VE + BLM;
    cout << new_VE;
    }

    I dont think i totally understand your question but what i think u meant i left some code for. could you specify more.. do you have any sample code?
    thanks for the reply. yes im dividing the blm by 128 because thats what its supposed to be. so X is how much its off by. then I take X * the VE I have right now to get the new VE. hope that makes sense. im trying to make it as simple as possible without schooling everyone on tuning here lol

  6. #5
    scott0999 is offline Newbie
    Join Date
    Feb 2007
    Posts
    3
    Rep Power
    0
    heres an example,

    I had a BLM of 130 and an original VE of 6.25 so this is what I would do

    130/128=1.05*6.25=6.56

    old blm, what blm should be, X, VE, new VE

    actually now that I think about it, the adding and subtracting if the blm was above/below 128 doesnt matter since you can just multiply X by the VE

  7. #6
    Deathcry's Avatar
    Deathcry is offline Learning Programmer
    Join Date
    Feb 2007
    Posts
    69
    Rep Power
    0
    didnt have much time but is this what you wanted?
    Code:
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        double blm, x, ve, new_ve;
        
        cout << "Insert BLM ";
        cin >> blm;
        
        cout <<"Insert VE "; //not sure how you wanted if you insert or pre set number
        cin >> ve;
        
        x = blm / 128; 
        new_ve = x * ve;
    
        if ( blm < 128 ) {
           new_ve - blm;
           cout << new_ve;
        }
        else if ( blm > 128 ) {
             new_ve + blm;
             cout << new_ve;
        }
        system("PAUSE");
        return 0;
    }
    the code is with you

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need a small program.peice of software designed.
    By zCaptain in forum Request Services
    Replies: 1
    Last Post: 01-15-2012, 12:43 PM
  2. Seeking Someone to Create a Small Program
    By GGEden in forum Request Services
    Replies: 3
    Last Post: 03-27-2011, 06:34 AM
  3. Small basic program (Geo)
    By Geo in forum Visual Basic Programming
    Replies: 1
    Last Post: 12-21-2010, 04:14 PM
  4. some errors in small program
    By onus in forum C and C++
    Replies: 2
    Last Post: 09-21-2010, 09:44 PM
  5. A small problem in my calc program
    By nolls in forum Pascal and Delphi
    Replies: 18
    Last Post: 02-27-2008, 09:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts