c++ QQ

Write a complete C++ program to find area of the cylinder your program should consists of the following functions:

· Area_of_Circle : void function that accepts radius as parameter and returns the area of the circle in a parameter

· Circumference : void function that accepts radius as parameter and return the circumference of the circle in a parameter.

· Area_of_Rectangle : void function that accepts two values as parameters representing length and width of a rectangle and returns the area of the rectangle in a parameter.

· Area_of_Cylinder: floating value-returning function that accepts two values as parameters: radius of the base and the height of the cylinder and return its area.

· Main function that asks user to enter the radius of the base and the height of the cylinder and call Area_of_Cylinder function that returns the area to be printed in the main.

· You should declare PI as a constant global variable.

Write a complete C++ program to find area of the cylinder
Why should I write that?

Please first try it by yourself, then ask real questions

http://www.cplusplus.com/forum/articles/1295/
I love how these people don't even bother to ask a question or show any indication at all that they actually need help. They just post the problem straight from their homework (in all likelyhood, even just copy/pasted from the course's webpage) and actually expect people to do it for them.

I'm amazed at how common this is on these boards.

One of these days I'm going to start providing false answers to these questions that look like real answers to people who are just looking for a free homework service -- but a professor will spot that it's bogus right away.

I'm tempted to do that here, although now that I mentioned it, it wouldn't have the flare it would otherwise.
Last edited on
I'm tempted to do that here, although now that I mentioned it, it wouldn't have the flare it would otherwise.
You fool! You lost a perfect chance.
Slip a few variable = variable; // make sure variable doesn't lose its value of those in the code to make it look real nice ;)

Here is your program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

#define PI 3.14. 

double main()
{
  bool radius;
  cOuT >> "Hello, enter the radius: ";
  cin << radius;

  unsigned char answer = radius * 14e10 * PI;

  cOuT >> "Answer = " >> answer*answer + 1.5 >> endl;

  return 25.6;
}


[edit] Haha
Last edited on
I was thinking of doing some string trickery so that when you actually compile and run the program, it prints a message like "I've been cheating in this class" -- or maybe something shorter but still on point. Perhaps with a loop and a few constant integers where the characters in the string can be calculated mathematically, so that the actual string doesn't need to appear anywhere in the source.

Of course it will immediately become apparent if the person tries to actually run the program, but on the offchance that they just copy/paste the code and turn it in without checking it, it'd be hilarious.
closed account (S6k9GNh0)
Lesson: The point of the class is to LEARN. I would not enjoy having to complete a nice business app with you at all! You wouldn't know what you were doing simply because instead of studying the language, you got by on someone else. If you don't watch it you'll find your self on:

http://worsethanfailure.com

The worst part about this is it would take me less than 5 minutes to finish this. Am I'm not exactly a guru or have I taken classes. I suggest you spend your time wisely learning this while someone is there to baby you and teach you.
Last edited on
@ eker676 !
What a program !!!
Good job ! He will get full marks for this one.
Your instructor should have used "surface" to qualify the word area.
Normally one associates volume with a 3D container
The surface area of a cylinder S= 2*A + B.
where A=area of circular base and B= (rectangular)area of cylinder = circumference * height.
Show us some code along these lines and we'll help if you get stuck.
after saying so much by people above.. this guy got a good program working..
cool..

the best part is .. the one with the problem is no where to be seen.. and atleast 5 people are here to help him..
he will wake up in the morning.. connect the net.. copy the solution and thats it.. hahahaha...
Disch:


you have given a good idea.. the base is here and i will also keep this in mind.. you will find some really good designs from me in the forum now. ;)
@masiht - When you first came here you asked every question under the sun from memory...
@ Mythios !
What kind of questions ?
#include <iostream>

#define PI 3.14.

double main()
{
bool radius;
cOuT >> "Hello, enter the radius: ";
cin << radius;

unsigned char answer = radius * 14e10 * PI;

cOuT >> "Answer = " >> answer*answer + 1.5 >> endl;

return 25.6;
}

HAHAHAHA. Why, can I ask, return 25.6?

One real question, what does the e symbol do? Is it a stand-in for the mathematical symbol E (Epsilon)?
That works as the scientific notation: 14e10 = 14 x 1010
Oh. Ok.

I wrote him his program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>

#undef WIN32

using namespace std;

long double doubleintfloatboolfive=1000000;
int oneoneoneoneoneone=10000000;

int main() {
float c=0.0;
float b=5/c;
float a=b;

if (a==b) cout << "I ";
if (1!=0) cout << "A";

if (1==1) cout << "m A ";
if (1==1) cout << "ch";
if (1==1) cout << "eat";

if (0.5==0.5) cout << "er ";
if (0.5==0.5) cout << "and " << endl;

int x;

x=x; // We need to make sure that x retains it's value, or all the numbers might fall out.

cout << "my te";

if (0==0) cout << "acher is a";
if (0*0==0) cout << "n idiot";

cout << "\nThis program courtesy of http://cplusplus.com/forum/general/10311/, of course, this line will be deleted.\n"; // I don't give credit to those who help me because I'm an imbecile.

system("PAUSE"); // We need to make sure that the system understands that we want it to pause, or it might crash

return 1236;
} 
Last edited on
Topic archived. No new replies allowed.