A cheat sheet for circles


Joined
Jun 1, 2017
Messages
55
Reaction score
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;
}
 
Ad

Advertisements

Joined
Apr 25, 2017
Messages
215
Reaction score
26
1. You miss symbol << in line
Code:
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:
 double Area(double radius)
    {
    return pi * radius * radius;
    }

4. Mispelling: Should be namespace in second line.
 
Ad

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. After that, you can post your question and our members will help you out.

Ask a Question

Top