Anybody plz help me with C

Discussion in 'QnA (read only)' started by bizzare_blue, Dec 14, 2004.

Thread Status:
Not open for further replies.
  1. bizzare_blue

    bizzare_blue New Member

    Joined:
    Aug 8, 2004
    Messages:
    246
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Lucknow
    Can anyone tell me the syntax 4 using printf n scanf commands in C? Urgent........
     
  2. diab0lic666

    diab0lic666 New Member

    Joined:
    Sep 3, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Godless Savage Garden.
    Code:
    printf ("This is syntax to display text on console");
    
    scanf (&p); //takes value for variable p.
    btw, this is the lamest question i have ever seen. you cud have used google or reffered a book instead of starting a whole new thread here. oh well take care of this in future.
     
  3. thinkdigit

    thinkdigit New Member

    Joined:
    Dec 7, 2004
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
  4. lamrinnirmal

    lamrinnirmal New Member

    Joined:
    Jan 14, 2004
    Messages:
    158
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    /bin/sh
    Code:
    printf("text on screen goes here");
    scanf("format string", list of variables preceeded with &);
    
    eg scanf("%d",&num);
    inputs an integer value in the variable num
     
  5. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    printf() is way too primitive and silly. I have made my own functions that replaces silly printf(), clrscr(), gotoxy(), etc. There are other functions like drawbox(), savescrn(), restscrn(), etc. I have also made a substitute of scanf() and called it get(). But I don't know whether it works properly.

    I have a small library of about 40-50 functions that I have made for C. All that you need is a #include statement at the beginning to include the code. I have made a few .h files that may increase convenience. My functions could make coding easier. Concentrate on main logic, not repetitive tasks. :)

    PM me if you want them. BTW, I made them in 1994. So they are pretty old and for Turbo C (under DOS). They may still work. You can try. I suggest have a look. All my code is free and open source ;) :D and may be useless now after so many years :cry:
     
  6. sms_solver

    sms_solver New Member

    Joined:
    Jan 2, 2004
    Messages:
    420
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    somewhere
    Buy a good book of C

    :arrow: Let us C
    :arrow: Intro to ANSI C by Balaguruswamy
     
  7. indrajit

    indrajit New Member

    Joined:
    May 20, 2004
    Messages:
    197
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Kolkata
    "Let us C" is a good book for the beginners, who doesn't know anything except the name "C". Seeing the pattern of your question, I'm sure thats the right book for you! :wink: Anyhow, I didnt like the book by Balaguruswamy at all. My suggestion is, once you are versed with the sintaxes, if you are still interrested and really want to learn C, then go for C by Herbert Schildt.
    @diabolique: The scanf function, as already mentioned is incorrect. And, some compilors don't allow the space between the printf and the"( )".
    @tuxfan: I'd really like to see what you've had done with the libraries, I'll PM you my mail id and if its not too much please send me those files!
     
  8. bhare ka tattoo

    bhare ka tattoo New Member

    Joined:
    Mar 27, 2004
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    0
    any book on c could have helped you out
     
  9. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    I have received a few PMs for the functions :) I am really glad :p

    I think it will be convenient for me to upload it somewhere and offer for download from there rather than sending it by email to everyone.

    Please give me some time. I will upload it and post a link for download.

    But please let me make it clear that they were made under DOS. Good for learning, but may be not of any practical use under Windows environment. But I may be wrong.
     
  10. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    Here's a description of functions kept at the beginning of the functions source. Some of they may be really useless, but I got carried away at that time ;)
     
  11. shakshy

    shakshy New Member

    Joined:
    Sep 4, 2004
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    0
    syntax

    syntax for your printf:-

    printf("control string",variable);
    eg:-
    printf("sum=%d",num);

    syntax for your scanf function

    scanf("input string",&variable);
    eg:-

    scanf("%d",&num);

    /* num is a variable such as int num */
     
  12. tuxfan

    tuxfan New Member

    Joined:
    Feb 4, 2004
    Messages:
    2,653
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    Mumbai
    Sorry for the delay in making my code available. I spoke to GNUrag and he says that even if it is very insignificant piece of code, it must be released in the right way. I am working under his guidance and will let everyone know when the code will be available.
     
  13. OP
    OP
    bizzare_blue

    bizzare_blue New Member

    Joined:
    Aug 8, 2004
    Messages:
    246
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Lucknow
    Thankx.....

    I wanted to thank you all for the help....sorry to tell u but i do program in C++.....a friend of mine wanted codes in C so I tried my hands on it....I suppose thats not a reason enough 4 buyin a book.....and if I had 2 buy a book....Y would I ask it on the forum????


    NEwayz....I wanted to know how to work with long integers n floating point nos. ....I mean the scanf statement needed 4 doin that.....NE BODY?????
     
Thread Status:
Not open for further replies.

Share This Page