Title: My new, (sort of...) Program
Description: program critique
digitalres - May 15, 2004 07:05 PM (GMT)
ok this is a program i wrote about 3 months ago, scince ive stopped trying to learn c++ out of frustration on finding a decent tutorial. but anyway here it is... please tell me what you think. oh and if you visit my site you can download a compiled version free. its
Digital Resolutionanyway heres the scource code
| CODE |
#include <iostream> #include <stdlib.h>
using namespace std; int main();
void aoc() { float aocb; cout<<"\n"; cout<<"What is the radius?\n"; cin>>aocb; aocb=aocb*aocb; aocb=aocb*3.141592654; cout<<"\n"; cout<<"The area is:\n"<<"\n"<<aocb<<"\n"; cout<<" \n"; system("PAUSE"); cout<<"\n"; cout<<"\n"; cout<<"\n"; main(); return; }
void circ() { float circb; cout<<"\n"; cout<<"What is the radius?\n"; cin>> circb; circb=2*circb; circb=circb*3.141592654; cout<<"\n"; cout<<"The circumference is:\n"; cout<<"\n"; cout<<circb; cout<<"\n"; system("PAUSE"); cout<<"\n"; cout<<"\n"; cout<<"\n"; main(); return; } void radius() { float radb; cout<<"\n"; cout<<"What is the circumference?\n"; cin>>radb; radb=radb/3.141592654; radb=radb/2; cout<<"\n"; cout<<"The radius is:\n"; cout<<"\n"; cout<<radb; cout<<"\n"; system("PAUSE"); cout<<"\n"; cout<<"\n"; cout<<"\n"; main(); return; } int main() { int menu; cout<<"1. Area of a circle\n"; cout<<"2. Circumference\n"; cout<<"3. Radius\n"; cout<<"4. EXIT\n"; cout<<"\n"; cout<<"\n"; cout<<"\n"; cin>> menu; if(menu==1) aoc(); else if(menu==2) circ(); else if(menu==3) radius(); else if(menu==4) return 0; return 0; }
|
C-Man - May 16, 2004 08:14 AM (GMT)
Sort of a HelloWorld as i see it ^_^
digitalres - May 16, 2004 06:09 PM (GMT)
No not really!
it is a formula calculator!
the code is basic but that is because i was still learning c++
hello world outputs garbage on the screen. this does geometry equations for you!
ih8censorship - May 16, 2004 06:36 PM (GMT)
i think its nice for a basic c++ program ^_^ i think he meant "hello world as i see it" as being a ton more basic than the stuff hes into now. if you still want to learn c++ you could download one of those big ebooks or buy a c++ book. i got the book i use off ebay for $11.00 including tax and there was a price tag of 76.95 on the back from some campus bookstore :lol:
C-Man - May 16, 2004 06:39 PM (GMT)
| QUOTE |
| i think he meant "hello world as i see it" as being a ton more basic than the stuff hes into now |
yeah something like that ^_^
PToN - May 17, 2004 03:33 AM (GMT)
I would just put all the functions outsite the main and just have one main that would have the menu with a switch()... Simpler and better structured...
C-Saw - June 20, 2004 01:27 PM (GMT)
About the book thing, go to campusi.com to get good deals on books.