[comp.sys.amiga.programmer] I need help with PDC

joshin@ucscf.UCSC.EDU (98896000) (04/12/91)

I just completed my first C program for my C class and I wanted to run it at
home so I got DICE C.  Well my program was to find the Volume of a cylinder
and since floating point isn't supported I couldn't do it on DICE.  So I got
PDC and now it seems that scanf doesn't work.   Here is my program, please tell
me if I'm doing something wrong:
 
#include    <stdio.h>
 
#define     PI	    3.1419

float   Radius, Height, Volume;	/* declares variables used */

main()
{ 
    printf("\n This is a program that will compute the volume of a cylinder. ");
    printf("\n Please enter the radius: ");     /* prompt for radius */
    scanf("%f", &Radius);
    printf(" Now please enter the height: ");   /* prompt for Height */
    scanf("%f", &Height);
    Volume = Radius * Height * PI;
    printf("\n The volume is %f . \n", Volume);
 
}
 

All the program does is print out the print commands.  Help please.

"F. Michael Theilig" <GKZ117@uriacc.uri.edu> (04/14/91)

On 12 Apr 91 00:32:08 GMT 98896000 said:
>
>I just completed my first C program for my C class and I wanted to run it at
>home so I got DICE C.  Well my program was to find the Volume of a cylinder
>and since floating point isn't supported I couldn't do it on DICE.  So I got
>PDC and now it seems that scanf doesn't work.   Here is my program, please tell
>me if I'm doing something wrong:
>
>#include    <stdio.h>
>
>#define     PI	    3.1419
>
>float   Radius, Height, Volume;	/* declares variables used */
 ^^^^^
     Do you have the registered or unregistered version of DICE?  The
 unregistered version doesn't do floats.  It should give you an error.
 By the way, is there any reason why you are making these vars global?

 [Rest or progam deleted for brevity sake.]

--------
     F. Michael Theilig  -  The University of Rhode Island at Little Rest
                            GKZ117 at URIACC.Bitnet
                            GKZ117 at URIACC.URI.edu

                                               Though you'd like to know.