Thread: easy question

  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
    Chappell Hill, Texas
    Posts
    2,332
    Code:
    #include <stdio.h>
    
    int main()
    {
    	char a;
    	printf("get me a value ");
    	a = getchar();
    	printf("&#37;c",a) ; 
    	return 0 ; 
    }
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    62
    thank
    Last edited by joker_tony; 04-02-2008 at 10: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, 07: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, 10:43 PM
  5. Easy Question
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2002, 12:19 PM