can some one help me with this program please- urgent

This is a discussion on can some one help me with this program please- urgent within the C Programming forums, part of the General Programming Boards category; when i run it is giving me an error saying illegal use of floating point and cannot covert 'float(*)(float) 'to ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    1

    can some one help me with this program please- urgent

    when i run it is giving me an error saying illegal use of floating point and cannot covert 'float(*)(float) 'to 'float'

    this is the source code
    Code:
    #include <stdio.h>
    #include <conio.h>
    
    
    int discount (int x);
    float tax (float y);
    
    
    main ()
    {
    
    
        int code[10];
       int i,after_discount;
       float after_tax,total;
       int cost=500;
    
    
       for (i=1;i<10;i++){
           printf ("Enter the book code");
          scanf ("%d", &code[i]);
          }
    
    
       total = 500.00 * 10;
       after_discount = total - discount (cost);
       after_tax = after_discount + tax (total);
    
    
       printf ("Discount is: %d\n", discount(cost));
       printf ("After discount: %d\n",  after_discount);
       printf ("Tax is : %.2f\n", tax (total));
       printf ("Amount to be paid: %.2f", after_tax);
    
    
       printf ("Book Codes\n");
    
    
       for (i=1;i<10;i++){
    
    
       printf ("\t%d", code[i]); }
    
    
    
    
    
    
    getch ();
    return 0;
    }
    
    
    int discount ( int x)
       {
       int four_books,discount;
        four_books = x * 4;
        discount = 0.10*four_books;
        return discount;
        }
    
    
    float tax (float y)
        {
           tax = 0.10 *y;
          return tax;
          }

  2. #2
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,344
    Code:
    float tax (float y)
    {
        float a_variable;
        a_variable = 0.10 *y;
        
        return a_variable;
    }
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with a turbo c program....urgent plz help
    By hassan_shohag in forum C Programming
    Replies: 10
    Last Post: 06-27-2010, 01:14 PM
  2. C Program help (urgent)
    By haris in forum C Programming
    Replies: 4
    Last Post: 05-14-2008, 04:24 AM
  3. Help needed with program - urgent thanks!
    By lildevil in forum C Programming
    Replies: 1
    Last Post: 03-09-2008, 06:45 AM
  4. urgent help for this difficult program
    By ptr_ritchie in forum C Programming
    Replies: 1
    Last Post: 04-01-2007, 01:42 AM

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