Thread: Newbie trying to work w/ KR book!?!

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    Newbie trying to work w/ KR book!?!

    I'm trying to self teach C by using KR book and Dev C++ 4.9 and am having two problems. 1) No output shown and I believe I'm missing something else. Anyone help me out?
    Thanx

    Code:
    #include <stdio.h>
    /* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */
    main()
    {
         float fahr, celsius;
         float lower, upper, step;
    
         lower = 0;      /* lower limit of temperature scale */
         upper = 300;    /* upper limit */
         step = 20;      /* step size */
    
         fahr = lower;
         while (fahr <= upper) {
             celsius = (5.0/9.0) * (fahr-32.0);
             printf("%3.0f %6.1\n", fahr, celsius);
             fahr = fahr + step;
         }
    }

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    Nevermond!

    Learned about system("PAUSE"); and return 0;

    Thanx anyway!

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: Nevermond!

    Originally posted by Slimcracker
    Learned about system("PAUSE"); and return 0;

    Thanx anyway!
    More options are in here
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    385
    Or you can just run it from the command line and not have to worry about adding anything in there to pause it.
    Wandering aimlessly through C.....

    http://dbrink.phpwebhosting.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. JavaScript book recommendations
    By neandrake in forum Tech Board
    Replies: 2
    Last Post: 04-05-2009, 12:27 PM
  2. new book about game programming using DirectX
    By Carlos in forum Game Programming
    Replies: 0
    Last Post: 09-20-2005, 08:30 AM
  3. Can't display book and borrower's details.
    By grscot in forum C++ Programming
    Replies: 0
    Last Post: 05-02-2003, 10:18 AM
  4. My book recommendations for rank beginners ...
    By snakum in forum C++ Programming
    Replies: 4
    Last Post: 08-21-2002, 10:38 AM
  5. newbie with an old book
    By Joseph in forum C Programming
    Replies: 13
    Last Post: 08-28-2001, 05:06 PM