/* Author: Zach Dunbar For: Statics 223H Honors Project Date: Fall 2000 Truss analysis Program 1.0 I had trouble putting this input a more pure object orients design because of the user specified number of vertices that will be input. I haven't yet figured out how to set up a private member variable array inside of a class, without giving a predetermined value. ie, i could set up the program in a clean fashion and allow exactly 5 10 or 2 user input vertices, but I don't know how to do it so the user can give different # of vertices each time. I decided to forgo figuring this out and work on getting actually working code, that can be transfered over if I ever figure out how to properly code this thing in an object oriented fashion. I'm sure it can be done, i'm just not sure how. I'm a strong believer in 'if it ain't broke, don't fix it'. This isn't the neatest code in the world, but it does its job, and although it might not be super efficient, it has enough comments that other programmers should be able to figure things out */ #include "trussheader.h" int main() { int total,W,R,roller,hinge,number,One,Two; char XXX,ans; double Xvalue[total],Yvalue[total],Force[total];//sets up arrays for important forces double vector[2*total-3][3];//last[] will always be 3, first[] is based on total members present do{ cout<<"------Welcome to Truss Calculator 1.0------\n\n"; warning();//gives info on what directions are + and which are - cout<<"Enter the total number of Vertexes\n";//currently only works for 3. cin>>total; test(total); cout<<"Enter Coordinates and Forces now.\n"; for (number=1; number <= total; number++)//user input for all values of each vertex { cout<<"X=\n"; cin>>Xvalue[number-1]; cout<<"Y=\n"; cin>>Yvalue[number-1]; cout<<"Force=\n"; cin>>Force[number-1]; } cout<<"\n"; system("cls");//clear screen command. all the basics are now entered. for (number=1; number <= total; number++)//Summary { cout<<"Vertex #"<>XXX; while (XXX == 'Y' || XXX == 'y')//Review { do //lets the user review individual vertices and their components { //insures accuracy cout<<"enter vertex to review\n"; cin>>W; summary(Xvalue[W-1],Yvalue[W-1],Force[W-1]); cout<<"Review another vertex?\n"; cin>>XXX; }while (XXX == 'Y' || XXX == 'y'); system("cls"); } cout<<"Would you like to compute the distance between 2 vertices?\n"; cin>>XXX; //Finds Distance while (XXX == 'Y' || XXX == 'y') { do { cout<<"Enter 2 vertices to compute distance betweeen\n"; cout<<"(enter origin point followed by endpoint)\n"; cin>>W; cin>>R; difference(Xvalue[W-1],Yvalue[W-1],Xvalue[R-1],Yvalue[R-1],W,R);//finds difference cout<<"Find new distance?\n"; cin>>XXX; }while (XXX == 'Y' || XXX == 'y'); system("cls"); } briefsum(total);//displays# of joints and # of members cout<<"Input the vertex which is in contact with the ground\n"; cout<<"and on rollers(only vertical force exerted)\n"; cin>>roller; cout<<"Starting at the roller, vertex "<>One; cout<<"Enter the 2nd vertex that vertex "<>Two; cout<<"summary of roller (Vertex "<>ans; }while (ans == 'Y' || ans == 'y'); cout<<"Thanks for running Truss Calculator 1.0. Have a great day.\n"; system("PAUSE"); return 0; }