PDA

View Full Version : C++ help, i suck at it!


defiants14
10-16-2002, 11:02 PM
im having problems wiht my hw, its about calling, declaration etc.. i didnt start anything beccause frankly i dunno how to start it to make it call things. below is the problem

http://www.geocities.com/chinh_n_nguyen/hw.jpg

(visit that link for the picture)


Given r and d, in cm, write a program to calculate:
1. the area of circle
2. circumference of circle
3. colume of cylnder formed by displacing the circle by d.

program structure:
Main <---> Area
/\ /\
| |
\/ \/
Volume Circum


MAIN: reads r and d. calls area to calculate the area. calls vol to calculate the colume. then prints values of r,d,area,cirum, and vol

Area: calls circum to calc the circum

all functions area integer type and return 0

output:

Radius D Area Circum voulme
-------------------------------------------------------------
III II FFF.FF FFF.FFF FFF.FFFF




if anything sounds weird, dont ask me cuz dats wat i got from the teacher, damn he sucks

IM me if u wish: azn ixtci style

or email me : viet_nismo@hotmail.com


Thanks for your help!

Trung Quốc
10-16-2002, 11:35 PM
First should should declare 3 prototypes for your functions.

Then in the main write a loop in which you will ask the user to input r and d then give the user the option of choosing
1) Area
2) circuference
3) Volume
-1) to exit.

Then use "case" or "if then else" to see which one the user choosed.

Base on that value, you will call an approriate function

Your functions (area and circuference) should accept 1 variable and return nothing.
the other function (volume) shoud accept 2 variables and return nothing as well.

Goodluck.

QT

CAptain DaLaZBoi
10-17-2002, 12:08 AM
:) :) :)

defiants14
10-17-2002, 01:13 AM
i dont think we learned all that, we are not that far ahead to let ppl choose which one. or case or "if then else"..this is like a basic intro to C++ programming, i showed my friend other problems and he said its more C than C++ cuz we still use "scanf()" and "printf()"

CAptain DaLaZBoi
10-17-2002, 01:23 AM
dont need to use if else

just call all the functions in the main

CAptain DaLaZBoi
10-17-2002, 01:28 AM
i learned c++ and using cout and cin mainly... i never get to use printf so...... hong biet :)

rotkt
10-17-2002, 01:53 AM
the link is not working
is it how the problem originally stated? (not so clear).
if you still need help, try to post the original prob here or email me

defiants14
10-17-2002, 04:19 AM
yea..geocities suck..juss type that link or copy and paste it into a browser and it will work

that is the original problem, the teacher is from another country originally, so he doesnt speak english or write it well, and thats how he wrote it