i would like the result to stay on the screen!

This is a discussion on i would like the result to stay on the screen! within the C Programming forums, part of the General Programming Boards category; Hi iam new to programming ia using Dev C++ 4.9 as my compiler. When i compile an run the program ...

  1. #1
    wise_ron wise_ron's Avatar
    Join Date
    May 2006
    Posts
    75

    i would like the result to stay on the screen!

    Hi iam new to programming ia using Dev C++ 4.9 as my compiler. When i compile an run the program it works fine but i want it to stay in the dos to see my results, the programs runs and it quickly ends so i cannot see the results.
    what do i need to add to this code so it will display my name or result and stay there.

    thanks

    Code:
    #include <stdio.h>
    int main()
    {
        char name[40];
        printf("Please enter your name: ");
        scanf("%s", &name);
        printf("Your name is %s", name);
        return 0;
    }

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    34

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    Code:
    #include <stdio.h>
    int main()
    {
        char name[40];
        printf("Please enter your name: ");
        scanf("%s", &name);
        printf("Your name is %s", name);
        getchar();
        return 0;
    }
    ssharish2005

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Last edited by Dave_Sinkula; 05-14-2006 at 12:10 AM. Reason: More crayons.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux Problem Screen Resoultion
    By Matus in forum Tech Board
    Replies: 1
    Last Post: 01-29-2009, 04:39 PM
  2. [C] GDI: how to erase material drawn at an entire screen DC
    By pc2-brazil in forum Windows Programming
    Replies: 3
    Last Post: 01-24-2009, 07:24 PM
  3. Why am I getting these errors??
    By maxthecat in forum Windows Programming
    Replies: 3
    Last Post: 02-03-2006, 01:00 PM
  4. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM

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