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;
}
 
Joined
Apr 25, 2017
Messages
259
Reaction score
36
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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top