Solved

write a program that reads in the radius of a circle

Posted on 2001-06-05
8
350 Views
Last Modified: 2008-03-03
and prints the circle's diameter, circumference and area. Use the constant value 3.14159. Do each of these calculations inside the prints statements and use the conversion specifier %f.

anyone can helps me, i am a novice of C++, so please, THANKS.
0
Comment
Question by:marcuskhor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:marcuskhor
ID: 6157112
thanks for devx.com, it helps me a lot and thanks for those who answers my question.
0
 

Expert Comment

by:omkamal
ID: 6157206
#include <iostream.h>

void main()
{
     double r;
     double area, circum, dia;
     const double pi = 3.14159;

     cout << "Enter the radius:";
     cin >> r;

     area = pi * r * r;
     dia = 2 * r;
     circum = pi * dia;

     
     cout << "\nRadius entered :" << r << "\n";
     cout << "Area :" << area << "\n";
     cout << "Diameter :" << dia << "\n";
     cout << "Circumference :" << circum << "\n";
     return;
}

You can make this code more fashionable. But since you said you are a novice this would be more simpler to start with. You can also use printf statements and specify %f inside them. But using cout, cin would be more of C++ then using printf and scanf which are C functions.

By the way, is this what you want?
0
 
LVL 22

Expert Comment

by:nietod
ID: 6157235
We cannot do your schoolwork for you.  That is unethical and is grounds for removal from this site.  (for both you and the experts involved.)  

We can provide only limitied help in accademic assignments.    We can answer specific (direct) questions, like you might ask your teacher.  We can review your work and post suggestions, again, like your teacher might do.

Do you have specific questions?
Do you have any work on this (incomplete even) that we can review?

********************************

omkamal, don't help people cheat!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:omkamal
ID: 6158161
Marcuskhor,

Nietod may be right. I am wondering why you asked such a question in the expert zone. Please do not try to waste others time. Forgive me if I really hurted you. All we say is such a question is an exercise that can be found in any beginner's c++ book or any c++ learning website. We all try to be helpful here. But not for anything in the world. Knowledge Exchange Expert Zone has got specific goals. See you back in 5 or 6 months.
0
 
LVL 6

Expert Comment

by:Talmash
ID: 6158929
hi all .

your problem is both c++ language and mathematics .

I can offer my help by solving (try) hardest mathematical
problems .

Tal
0
 
LVL 22

Expert Comment

by:nietod
ID: 6159886
omkamal ,
   There is nothing wrong with a beginner asking for help here.  But a student cannot ask use to do their work for them.  they can only ask for _assistance_.  Like tutoring.
0
 

Accepted Solution

by:
amp072397 earned 0 total points
ID: 6163826
Hello marcuskhor, welcome to EE. If you have not done so, you should read the membership agreement at http://www.experts-exchange.com/jsp/infoMemberAgreement.jsp

I hope you understand EE's policy. If you don't learn how to code it yourself, you're not learning at all. Please do not ask specific questions again. You are allowed to ask only for guidance and direction for homework issues.

I've removed the points from this question. Experts who answer homework issues receive no points because it's really not permitted.

No one will be "removed from the site" unless this is done repetitively. Threatening statements like that will only make you feel unwelcome, and you ARE welcome here.

marcuskhor, I'd like to delete this question as soon as I know you understand.

Thanks everyone.
amp
Community Support Moderator
Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6811470
Closed by
EE Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question