Conversion error

This is a discussion on Conversion error within the C Programming forums, part of the General Programming Boards category; Code: #include <stdio.h> #include <math.h> float Area(float); float Circumference(float); int main ( void ) { float radius; float refA; float ...

  1. #1
    Un Artiste Extraordinaire volk's Avatar
    Join Date
    Dec 2002
    Posts
    357

    Question Conversion error

    Code:
    #include <stdio.h>
    #include <math.h>
    
    float Area(float);
    float Circumference(float);
    
    int main ( void )
    
    {
    	float radius;
    	
    	float refA;
    	float refC;
    
    	printf("Enter a radius of a circle\n");
    	scanf ("%f", &radius);
    
    	refA = Area(radius);
    	refC = Circumference(radius);
    
    	printf("\nThe Area of the circle is %.2f\n", refA);
    
    	printf("\nThe Circumference of the circle is %.2f\n", refC);
    
    	return 0;
    }
    
    float Area(float radius)
    
    {
    	return (float) pow(radius, 2) * 3.14;
    }
    
    float Circumference(float radius)
    
    {
    	return (float) 2 * radius * 3.14;
    }
    Why does my compiler display a conversion warning for...

    Code:
    return (float) pow(radius, 2) * 3.14;
    and...

    Code:
    return (float) 2 * radius * 3.14;

  2. #2
    Un Artiste Extraordinaire volk's Avatar
    Join Date
    Dec 2002
    Posts
    357

    Smile

    Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 06:33 AM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21