where is the problem...?

This is a discussion on where is the problem...? within the C++ Programming forums, part of the General Programming Boards category; could someone finds whats is wrong..? Code: #include <iostream> #include <stdlib.h> using namespace std; inline float circleArea(float); int main(int argc, ...

  1. #1
    Registered User snapshooter's Avatar
    Join Date
    Sep 2004
    Posts
    37

    where is the problem...?

    could someone finds whats is wrong..?
    Code:
     
    
    #include <iostream>
    #include <stdlib.h>
    
    using namespace std;
    inline float circleArea(float);
    int main(int argc, char *argv[])
    {
     float r,E;
     float p=3.14;
     cout<<"Give r:"<<endl;
     cin>>r;
     E=circleArea(E);
     cout<<"E is:"<<E<<endl;
     
       
      system("PAUSE");	
      return 0;
    }
    float circleArea(float)
    {
     float p=3.14;
    
    return p*r*r;
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Did you even try to compile this? You do realize of course that in the function declaration you have to give your arguments names, and not just a type?

    Beyond that, don't just post code and say "what's wrong". Try telling us what the code:
    a) should do.
    b) does that it shouldn't.
    c) doesn't that it should.
    d) gives for error messages, if any.
    e) etc etc

    And if you provide the expected input and output of the program, it helps a great deal. No one that I know wants to simply read a bunch of code (even though this was a small example) just to try and guess what it is you have in mind. Keep that in mind for future posts.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    > E=circleArea(E);
    Try:
    E=circleArea(r);

    >float circleArea(float)
    Try:
    float circleArea(float r)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

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