• Log in or sign up for an account here: https://www.sythe.org/login

Geometric Calculator [first program]

SwiftSeller

Grand Master

Banned
Joined
Jun 21, 2008
Sythe Gold
0
Messages
2,461
Location
North Charleston, SC
Geometric Calculator [first program]
This basically takes the diameter of a circle and gives you all other specs for it. Its helpful for geometry classes, expecially the ones that give you huge numbers and you're too lazy to remember the forumlas ;) . I made it to help my brother in his math class, and I figured since its a pretty decent attempt at my first program, I'll release it on Sythe. Have fun.

Tell me what you think!

I'll add more shape compatibilites later (triangle, parallelogram, etc.)

Code:
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//Created by: Kyle Decedue[/COLOR][/SIZE]
 
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]<iostream>[/COLOR][/SIZE][/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] std;[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] main()[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]{[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//declaring variables:[/COLOR][/SIZE]
 
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] diameter; [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]double[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] radius, area, circumference;[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//input circle demensions:[/COLOR][/SIZE]
 
[/COLOR][/SIZE][SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Geometric Calculator v1.0\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Later versions will be compatible for multiple shapes.\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Input diameter value below, round to nearest whole number.\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Diameter: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]cin >> diameter;[/SIZE]
 
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//input formulas used:[/COLOR][/SIZE]
 
[/COLOR][/SIZE][SIZE=2]radius = diameter / 2.00;[/SIZE]
[SIZE=2]area = 3.14159 * (radius * radius);[/SIZE]
[SIZE=2]circumference = 3.14159 * diameter;[/SIZE]
 
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//output of solutions:[/COLOR][/SIZE]
 
[/COLOR][/SIZE][SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Area: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << area << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" units.\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Circumference: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << circumference << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" units.\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Radius: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] << radius << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" units.\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2]cout << [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Created by Kyle Decedue. "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
 
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] 0;[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]}[/COLOR][/SIZE]
 
Runescape Gamblingrunescape gambling
Back
Top