hello, first of all welcome, secondly someone please help me? this wont compile :(

#include <iostream>
int main() {
    
    float pi;
    float radius; 
    float area;
    
pi = 3.1415926535;
radius = 2;

area = radius * pi;

std::cout << "The area of a circle with a radius of 2 is " << (pi * radius) <<;

std::cin.get();

return 0;

}

Recommended Answers

All 6 Replies

>hello, first of all welcome
Thanks, it's good to finally be a part of an awesome forum like Daniweb. Wait, something's not right here...

>this wont compile
You have a rogue << at the end of your output statement.

when i said im new to programming, i ment im new and only 15 years old that is serious about giving this ago, if you would be kind into show me where? thank you.

when i said im new to programming, i ment im new and only 15 years old that is serious about giving this ago, if you would be kind into show me where? thank you.

The only output statement in your code, the hint would be that it has the word "out" at the beginning.

Thank you for your help :) my first piece of code, nothing special to brag but gotta start somewhere :)

i would also like to ask if i may, how to have me imput the radius for me to calculate the area?

Thank you for your help :) my first piece of code, nothing special to brag but gotta start somewhere :)

i would also like to ask if i may, how to have me imput the radius for me to calculate the area?

std::cin >> radius;

You're not calculating the area here.

area = radius * pi;

Here's the formula for calculating the area.

area = radius * radius * pi;

hehe thanks for pointing that out :P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.