easy question

This is a discussion on easy question within the C Programming forums, part of the General Programming Boards category; when i compile this program, and when i input a variable from the keyboard i would like to show the ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    62

    easy question

    when i compile this program, and when i input a variable from the keyboard i would like to show the variable how can i do that with a=getch();.
    For example if i type (a) it should show (a) on the screen

    Code:
    #include <stdio.h>
    #include <conio.h>
    
    int main()
    
    {
        char a,b;
        
        
    printf("get me a value ");
       a=getch();
      
     
       if (a==b)
        {            printf("\nhi");
               
                 
                 } 
     else{
           printf("\nruni");
    
    }
      
        getch();
      
    }

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Code:
    #include <stdio.h>
    
    int main()
    {
    	char a;
    	printf("get me a value ");
    	a = getchar();
    	printf("&#37;c",a) ; 
    	return 0 ; 
    }
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    62
    thank
    Last edited by joker_tony; 04-02-2008 at 11:32 PM.

  4. #4
    Registered User
    Join Date
    Feb 2008
    Posts
    62
    thank

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. easy Vector contructor question
    By noodle24 in forum C++ Programming
    Replies: 5
    Last Post: 04-21-2006, 08:43 PM
  2. Another Embarassingly Easy Question
    By almo89 in forum C Programming
    Replies: 2
    Last Post: 02-11-2006, 04:59 PM
  3. This is hopefully an extremely easy question...
    By rachaelvictoria in forum C Programming
    Replies: 2
    Last Post: 11-07-2005, 01:36 AM
  4. 4 easy question
    By Zeratulsdomain in forum C++ Programming
    Replies: 2
    Last Post: 10-15-2005, 11:43 PM
  5. Easy Question
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2002, 01:19 PM

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