Okay I had a thread on this already but it was under my friend's account and when I replied to it under my own account nobody knew what was going on and nobody responded after that so thats why I'm making a new one. What I'm trying to do is make a somewhat simulated datalogging program, one that you would hook up to your car's ECU to track its readings. I already have this code from Narue :) thanks again.

int main()
{
  int count = 0;
  for ( ; ; ) {
    if ( GetAsyncKeyState ( VK_ESCAPE ) != 0 )
      break;
    else if ( GetAsyncKeyState ( VK_UP ) & SHRT_MAX ) {
      if ( count < 100 )
        ++count;
    }
    else if ( GetAsyncKeyState ( VK_DOWN ) & SHRT_MAX ) {
      if ( count > 0 )
        --count;
    }
    std::cout<< std::setw ( 3 ) << count <<"% Throttle\r";
    Sleep ( 100 );
  }
}

And I'm trying to add in more readings on different lines. I already have the forumulas needed for them to be stemmed off the throttle reading seen above.

I'm trying add in the engine's RPM on the second line
RPM = TPP * 74.5 + 750

I'm trying to add in the car's KM/H on the third line
KPH = RPM * 0.0075

And I'm also trying to add in a VTEC indicator to just say VTEC ON/OFF on the fourth line.
If RPM greater than 5400 then say VTEC ENGAGED, if not then say VTEC DISENGAGED.

Now I've been trying to work this out myself for quite sometime but it seems I'm just no good at C++. I'm fine with Qbasic (ha) and HTML but C++ just seems to confuse the heck outta me. Please help if you can it would be greatly appreciated :)

If you are not good in C++ how come you are trying to do something as complex as Keypress event handling? Going through GetAsyncKeyState functions with little or no knowledge of C++ will only confuse you.
Wouldn't you be better off with trying to just write code for

RPM = TPP * 74.5 + 750;
KPH = RPM * 0.0075;

and C++ if else branching?

Forget about the KeyEvent Handling part for now. Write a program to get user input from keyboard, and display it. Then try decision making in C++ (if, else).

Go through the resources listed in here for a start.

I should have mentioned that I already have the basic take user's input and display stuff working thats why I wanted to upgrade to the key press stuff.

#include <iostream>
using namespace std;
int main()
    {
        int TPP;
          cout << "Enter your throttle position percentage: ";
          cin >> TPP;
          cout << "Your trottle position percentage is: ";
          cout << TPP;          
          
        int RPM;
          RPM = TPP * 74.5 + 750;
          cout << "\nWith that throttle position percentage your RPM is: ";
          cout << RPM;
          
        int KPH;
          KPH = RPM * 0.0075;
          cout << "\nWith that trottle position percentage your KPH is: ";
          cout << KPH; 
        
        int VTEC
        {
          if (RPM > 5400)
            cout << "\nVTEC engaged :D";
            else
            cout << "\nVTEC disengaged :(";
            }   
          
          
          cin.get();
          cin.get();
          return 0;
          }

Thats my basic stuff that works fine, but now I'm trying to do what I explained in my first post, I just need some help please.

Somebody has to know how to do this, help please :)

This article has been dead for over six months. Start a new discussion instead.