this program is suppose to take info from the user and list out angles, lengths, etc. then i have a picture of a ramp with lengths labeled as their corrisponding letter
here is the code:
[tag]
Code:
/*
|------------------------------|
| by: |
| start date: Feb. 28, 2006 |
| Advanced Ramp Calc Program |
| Version 1.01 |
|------------------------------|
*/
#include <iostream>
#include <math.h>
#include <fstream>
#include <cstdio>
using namespace std;
int main ()
{
//creats all integers
int n, a, b, c, d, z, width, flatlength, decklength, height, radius, flatheight;
char name[15];
float x, ramplft, ramplength;
// creates loop
while (n>0) {
//names rtf file
cout<<"what do u wish to call this file?"<<endl;
cin.getline( name, 15 );
//defines height
cout << "height(in.): "<<endl;
cin >> height;
//defines ramp width
cout<<"total width(in.): "<<endl;
cin >> width;
//defines radius
cout<<"radius(in.): "<<endl;
cin >> radius;
//defines flat height
cout<<"flat height(in.): "<<endl;
cin >> flatheight;
//defines flat length
cout<<"flat length(in.): "<<endl;
cin >> flatlength;
//defines deck length
cout<<"deck lenght(in.): "<<endl;
cin >> decklength;
//finds the length of z
z = radius - height;
//defines the z squared as b
b = z * z;
//defines the hypotonuse(radius) squared as c
c = radius * radius;
// finds the length of x squared
d = c - b;
//defines the value of the bottom of the ramp
x = sqrt(d);
//shows total length of ramp
ramplength = flatlength + decklength + x;
//shows length of ramp in feet
ramplft = ramplength / 12;
cout<<"the ramp will be "<<ramplength<<" inches long, or "<<ramplft<<" feet long"<<endl;
cout<<"A printable text file has been made and named as ramp.txt"<<endl;
//Cand opens ramp.rtf
ofstream a_file ( "ramp.rtf", ios::app );
// Outputs to file through a_file
a_file<< "(ft): "<<ramplft<<endl<<"w: "<<width<<endl<<"a: "<<x<<endl<<"d: "<<decklength<<endl<<"f: "<<flatlength<<endl<<"h: "<<height<<endl;
// Close the file stream explicitly
a_file.close();
//starts loop over
cout<<"Press any number to repeat: "<<endl;
cin >> a;
if (a == 1) {
n = 1;
}
}
cin.ignore();
}
[/tag]
there is some extra stuff in there htat will be used later...