Ask Experts Questions for FREE Help !
Ask
    shivanikoul's Avatar
    shivanikoul Posts: 1, Reputation: 1
    New Member
     
    #1

    Jan 7, 2012, 08:50 AM
    My question is related to c programming.
    Please sort out my difficulty regarding c programming.
    What is the technical meaning of getch() in c programming.
    Kahani Punjab's Avatar
    Kahani Punjab Posts: 510, Reputation: 203
    Senior Member
     
    #2

    Jan 7, 2012, 09:02 AM
    Shivani Koul,

    Welcome to this great site, first! I hope you are from India. Which state? Girls in India used to keep long/untrimmed hair. Is not it? What about yours?

    getch() returns the character you typed without displaying it on the screen. This is a nonstandard function that gets a character from keyboard, does not echo to screen.
    Wajid008's Avatar
    Wajid008 Posts: 1, Reputation: 1
    New Member
     
    #3

    Nov 4, 2012, 08:55 AM
    Take two input numbers save them in variables, also ask user what operation to perform like 1 for addition, 2 for subtract, 3 for multiply and 4 for divide. At the end of each result ask for re-computation or exit?
    strongard63's Avatar
    strongard63 Posts: 1, Reputation: 1
    New Member
     
    #4

    Oct 10, 2013, 07:06 PM
    some type function in c/c++ (at least the one I know) are for ,example , VOID OR INT
    but by I found ,in a website, a code in which there is a STRING function type . The code is long so I took a piece of it and here it is:

    string padIfNeeded (string ans)
    {
    if ( ans == "" )
    {
    return "";
    }
    return " " + ans;
    }

    string translateHundred (int hundred_chunk)
    {
    // handle special cases in the teens
    if ( hundred_chunk < 20 ) {
    return num_to_text[ hundred_chunk ];
    }
    int tens = hundred_chunk / 10;
    int ones = hundred_chunk % 10;
    return tens_to_text[ tens ] + padIfNeeded( num_to_text[ ones ] );
    }


    string translateThousand (int thousand_chunk)
    {
    if ( thousand_chunk < 100 )
    {
    return translateHundred( thousand_chunk );
    }
    else
    {
    int hundreds = thousand_chunk / 100;
    int hundred_chunk = thousand_chunk % 100;
    return num_to_text[ hundreds ] + " hundred" + padIfNeeded( translateHundred( hundred_chunk ) );
    }
    }

    I know that the string type function turn a string but I could not find this function type in c/c++ manual or in an article or even in Google so here are my questions
    1)how this function (string type function) works with examples and if possible articles , videos or manuals in the internet
    2)

    #include <string>
    #include <iostream>





    using namespace std;

    string show (string a )
    {
    printf("%s\n" , a);
    }
    int main()
    {

    string c = " hello world";

    foo(c);
    }


    the compiler gives an error:cannot pass objects of non-POD type `struct std::string' through `... '; call will abort at runtime



    2)why the compiler give such an error and how to correct the code using string type function??
    mohini singh's Avatar
    mohini singh Posts: 1, Reputation: 1
    New Member
     
    #5

    Jun 17, 2014, 02:41 AM
    Getch() in c basically is a predefined function of conio.h header file in c.
    It is get character with echo off.it means whenever we use getch() it will take a character and will not display it on console.
    It is myth that getch() is use to hold screen... actually it is use at the end of program just before return because theprogram will terminate when the getch() statement is executed when we hit a character or enter getch() takes it and then the prgram is terminated.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Stock Related Question [ 4 Answers ]

When you see for example: Portugal Telecom SGPS (ADR) (Public, NYSE:PT) What does ADR stand for? It says that: Currency in USD. What is the Tax on A foreign dividend stock?

Programming vb question [ 1 Answers ]

Hello and good day to all... I created a database contains "Down Time" table inside this table there is 'employee number' , 'no material PC' and other columns and now I am programming in Visual Basic 2010 and I want to retrieve all the sum of all values that entered into 'no material PC'...

Physics related question [ 0 Answers ]

Hi this is mahesh I have completed my graduation(B.Sc M.P.Cs) with 79.05% and wrote the PG in PHYSICS entrance then I got the rank 499 in osmania university hyderabad could you tell me which college I will got and which course gives the best future and carer opportunities plzzzzzzzzzz

Programming Question. [ 3 Answers ]

Hi, I'm stumped with this.. Can you please help? How would I design nested structures that perform: If amount1 is greater than 10 and amount2 is less than 100, display the greater of amount1 and amount2


View more questions Search