anybody dare to try this?

This is a discussion on anybody dare to try this? within the C++ Programming forums, part of the General Programming Boards category; anybody can help me to solve the problem that i face in c++ in c++ dos mode i want to ...

  1. #1
    Registered User
    Join Date
    Jul 2002

    anybody dare to try this?

    anybody can help me to solve the problem that i face in c++

    in c++ dos mode i want to make like this, when u run the prog:

    please select this(a, b)?_

    and if user press "b" key without hitting the "enter" key i want this line come out

    u pressing "b" key

    is it possible by just pressing the "b" key only and without pressing the "enter" key the line above will appear?

    please anybody can help me with the complete source code?

  2. #2
    looking for the truth moemen ahmed's Avatar
    Join Date
    Feb 2002
    use getche() from conio.h
    here w e go :::::::::::::::
    #include <stdio.h>
    #include <conio.h>
    int main(int argc, char *argv[])
    printf("press a or b  ");
    char a=getche();
    printf("\nyou pressed %c",a);
      return 0;
    hope i helped u
    Last edited by moemen ahmed; 07-04-2002 at 11:02 PM.
    Programming is a high logical enjoyable art for both programer and user !!

  3. #3
    D3T is offline
    Registered User
    Join Date
    Feb 2002

    I was gunna suggest somthing like
    [i use borland turbo c++ 3.0 for dos]

    #include <iostream.h>
    #include "what_ever_else_u_need.h"
    int main() // arguments if u like
       char keypress;
       cout << "Please choose a or b:";
       keypress = getch();
          case 'a': cout << "You Pressed A"; /*do(this)*/; break;
          case 'b': cout << "You Pressed B"; /*do(this)*/; break;
          default: cout << "Invalid choice.. try again.."; main();
       return 0;
    or something like that.. (knowing me it would not work anyway)
    Borland Turbo C++ 3.0 For Dos

    do { war(); } while (nations == hostile);

    ... The best way to prevent wars is to have them.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory Allocation (dare!)
    By cof in forum C Programming
    Replies: 3
    Last Post: 05-05-2003, 04:20 AM

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