A cheat sheet for circles

Discussion in 'C Programming' started by Thiefcom, Jul 25, 2017.

  1. Thiefcom

    Thiefcom

    Joined:
    Jun 1, 2017
    Messages:
    55
    Likes Received:
    7
    Code(c):
    #include <iostream>
    using namespcae std;

    const double pi = 3.14;

    double Area(double radius);
    double Circumderence(double radius);

    int main(){
    cout "Enter radius:";
    double radius = 0;
    cin >> radius;

    cout << "Area is:" << Area(radius) << endl;

    cout <<"Circumderence is:" << Circumderence(radius) << endl;

    return 0;
    }

    double Area(double radius)
    {
    return Pi * raduis * raduis;
    }

    double Circumderence(double radius)
    {
    return 2 * pi * radius;
    }
     
    Thiefcom, Jul 25, 2017
    #1
    Ian likes this.
    1. Advertisements

  2. Thiefcom

    Thiefcom

    Joined:
    Jun 1, 2017
    Messages:
    55
    Likes Received:
    7
    DAMNIT
     
    Thiefcom, Jul 25, 2017
    #2
    1. Advertisements

  3. Thiefcom

    John Joe

    Joined:
    Apr 25, 2017
    Messages:
    114
    Likes Received:
    14
    Location:
    Malaysia
    1. You miss symbol << in line
    Code (Text):
    cout "Enter radius:";
    2. You declare pi, but you using Pi in Area function.
    3. It should be radius not raduis in Area function.
    Code (Text):
     double Area(double radius)
        {
        return pi * radius * radius;
        }
     
    4. Mispelling: Should be namespace in second line.
     
    John Joe, Jul 25, 2017
    #3
  4. Thiefcom

    Thiefcom

    Joined:
    Jun 1, 2017
    Messages:
    55
    Likes Received:
    7
    shit I did miss my namespace
     
    Thiefcom, Jul 26, 2017
    #4
  5. Thiefcom

    John Joe

    Joined:
    Apr 25, 2017
    Messages:
    114
    Likes Received:
    14
    Location:
    Malaysia
    solved ?
     
    John Joe, Jul 26, 2017
    #5
  6. Thiefcom

    Thiefcom

    Joined:
    Jun 1, 2017
    Messages:
    55
    Likes Received:
    7
    No I need to still finger out how to use that compiler
     
    Thiefcom, Jul 26, 2017
    #6
  7. Thiefcom

    John Joe

    Joined:
    Apr 25, 2017
    Messages:
    114
    Likes Received:
    14
    Location:
    Malaysia
    OK
     
    John Joe, Jul 27, 2017
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.