Thread: Program Display

  1. #1
    Registered User
    Join Date
    Nov 2008

    Program Display


    I am using the Dev-C++ compiler and editor and have noticed that when i try to run a program, the results flash so fast i cannot see it? For example, this program to compute the alternative in ASCII tables. It seems as though if i just press the enter key, my result is 10, but should i try to type a character it flashes on my screen too fast. Any ideas on how to stop this so i can actually see the results??


    int main ()
        printf("please input a character:\n");
        char a=getchar();
        printf("char is %c with value %d\n",a,a);

  2. #2
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    United Kingdom
    Run the program from the command line. Either that or add a line like system("pause"); at the end of it, although system("Pause"); isn't the best way of doing it, there are lots of other alternatives, which I'm sure others on here will mention.

  3. #3
    Registered User
    Join Date
    Nov 2008
    I have just figured it...i use the getchar(); twice since my program requires 2 outputs

    many thanks
    Last edited by Axiom; 11-08-2008 at 03:53 AM.

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I need the code of few programs in c++.plzzzzz help...plzzz
    By NAVINKR20 in forum C++ Programming
    Replies: 1
    Last Post: 05-08-2009, 09:13 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. Inheritance and Dynamic Memory Program Problem
    By goron350 in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2005, 02:38 PM
  4. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM