Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-28-2007, 10:00 PM
scott0999 scott0999 is offline
Newbie
 
Join Date: Feb 2007
Posts: 3
Rep Power: 0
scott0999 is on a distinguished road
Default 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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 02-28-2007, 11:23 PM
Deathcry's Avatar   
Deathcry Deathcry is offline
Learning Programmer
 
Join Date: Feb 2007
Posts: 69
Rep Power: 7
Deathcry is on a distinguished road
Default

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?
__________________
the code is with you

Last edited by Deathcry; 02-28-2007 at 11:25 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2007, 11:24 PM
Deathcry's Avatar   
Deathcry Deathcry is offline
Learning Programmer
 
Join Date: Feb 2007
Posts: 69
Rep Power: 7
Deathcry is on a distinguished road
Default

If admin could just delete this. posted it on accident
__________________
the code is with you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2007, 11:45 PM
scott0999 scott0999 is offline
Newbie
 
Join Date: Feb 2007
Posts: 3
Rep Power: 0
scott0999 is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2007, 11:57 PM
scott0999 scott0999 is offline
Newbie
 
Join Date: Feb 2007
Posts: 3
Rep Power: 0
scott0999 is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 03-01-2007, 01:19 AM
Deathcry's Avatar   
Deathcry Deathcry is offline
Learning Programmer
 
Join Date: Feb 2007
Posts: 69
Rep Power: 7
Deathcry is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Best program for SQL database manipulation Rhadamanthys Database & Database Programming 3 07-02-2007 03:32 PM
How do I Program another Program? ! bosco General Programming 1 06-15-2007 12:15 PM
Need help w/ word count program (ASAP) siren C and C++ 1 04-23-2007 09:14 AM
How to modify a program written in .NET 2.0? jackyjack C# Programming 7 03-27-2007 01:26 PM


All times are GMT -5. The time now is 02:02 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads