Thread: i would like the result to stay on the screen!

  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

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    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,005
    Last edited by Dave_Sinkula; 05-13-2006 at 11:10 PM. 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