send me the solution.

Discussion in 'C Programming' started by wahid, Jan 10, 2010.

  1. wahid

    wahid Guest

    • Using getch() command, write a program that
    will echo user key strokes onto the screen, and
    if the user presses a letter (A-Z, a-z), the
    echoed character will always be a capital
    letter. The program terminates when the user
    presses the ESC key

    • (Hint, ASCII code for ESC is 27, for ‘A’ is 65, and
    for ‘a’ is 97. the values are given in decimal
    notation)
    wahid, Jan 10, 2010
    #1
    1. Advertising

  2. wahid

    Ian Collins Guest

    wahid wrote:
    > • Using getch() command, write a program that


    C doesn't have a "getch() command".

    Are you incapable of doing anything for your self?

    --
    Ian Collins
    Ian Collins, Jan 10, 2010
    #2
    1. Advertising

  3. On 10 Jan 2010 at 7:06, wahid wrote:
    > • Using getch() command, write a program that will echo user key
    > strokes onto the screen, and if the user presses a letter (A-Z, a-z),
    > the echoed character will always be a capital letter. The program
    > terminates when the user presses the ESC key


    #include <stdio.h>
    #include <ctype.h>
    #include <curses.h>

    #define KEY_ESC 27

    int main(void)
    {
    int c, rv = 0;
    if(initscr() && cbreak() == OK && noecho() == OK) {
    printw("(escape to exit)\n");
    refresh();
    while((c = getch()) != KEY_ESC) {
    printw("%c", toupper(c));
    refresh();
    }
    if(endwin() == ERR)
    rv = 1;
    } else
    rv = 1;
    return rv;
    }
    Antoninus Twink, Jan 10, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Francis
    Replies:
    0
    Views:
    405
    Andrew Francis
    Jun 28, 2006
  2. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    Solution file not in the solution folder

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Sep 12, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,099
    Laurent Bugnion
    Sep 12, 2006
  3. , India
    Replies:
    17
    Views:
    1,043
    James Kanze
    Oct 1, 2007
  4. Replies:
    8
    Views:
    501
  5. email55555 email55555

    [SOLUTION] Ruby Quiz #14 LCD Numbers ( solution #2 )

    email55555 email55555, Jan 9, 2005, in forum: Ruby
    Replies:
    16
    Views:
    272
    David Tran
    Jan 10, 2005
Loading...

Share This Page