Program Display

This is a discussion on Program Display within the C Programming forums, part of the General Programming Boards category; Hi, I am using the Dev-C++ compiler and editor and have noticed that when i try to run a program, ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    10

    Program Display

    Hi,

    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??



    thanks!

    Code:
    #include<stdio.h>
    int main ()
    {
        printf("please input a character:\n");
        char a=getchar();
        printf("char is %c with value %d\n",a,a);
        getchar();
    }

  2. #2
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195
    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
    Posts
    10
    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 02:53 AM.

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459

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, 02: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, 04:23 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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