Geometric Calculator [first program]

Discussion in 'Programming General' started by SwiftSeller, Sep 9, 2009.

Geometric Calculator [first program]
  1. Unread #1 - Sep 9, 2009 at 1:20 PM
  2. SwiftSeller
    Joined:
    Jun 21, 2008
    Posts:
    2,461
    Referrals:
    0
    Sythe Gold:
    0

    SwiftSeller Grand Master
    Banned

    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]
     
< Enhanced Aim Hack leaked and cracked | What does PHP do? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site