0% found this document useful (0 votes)
2 views5 pages

C++ Bridge Load Analysis Program

This document presents a complete C++ program for a Bridge Load Analysis System, featuring functions to calculate dead load, live load, wind load, and maximum load capacity. It includes an interactive menu for user input and allows for repeated calculations until the user chooses to exit. The program is structured with clear function declarations and constants for easy modification.

Uploaded by

hammondw464
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

C++ Bridge Load Analysis Program

This document presents a complete C++ program for a Bridge Load Analysis System, featuring functions to calculate dead load, live load, wind load, and maximum load capacity. It includes an interactive menu for user input and allows for repeated calculations until the user chooses to exit. The program is structured with clear function declarations and constants for easy modification.

Uploaded by

hammondw464
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Here is a complete C++ program that fulfills your

requirements for the Bridge Load Analysis


System, including all five functions and interactive
menu navigation:
#include <iostream> #include <cmath> #include
<iomanip> using namespace std; // Function
declarations void DisplayMenu(); double
DeadLoad(double length, double width); double
LiveLoad(double length, double width); double
WindLoad(double width); double
MaximumLoad(double DL, double LL, double WL);
// Constants const double CONCRETE_DENSITY
= 2400; // kg/m³ const double
LIVE_LOAD_INTENSITY = 10000; // 10 kN/m² =>
10000 N/m² const double
AIR_DENSITY_CONSTANT = 0.613; int main()
{ int choice; char confirm = 'Y'; double length,
width, thickness; double deadLoad = 0.0, liveLoad
= 0.0, windLoad = 0.0, maxLoad = 0.0; cout <<
fixed << setprecision(2); cout << "Welcome to the
Bridge Load Analysis System" << endl; while
(toupper(confirm) == 'Y') { DisplayMenu(); cout <<
"Enter your choice: "; cin >> choice; switch
(choice) { case 1: cout << "Enter the length of the
bridge (m): "; cin >> length; cout << "Enter the
width of the bridge (m): "; cin >> width; cout <<
"Enter the thickness of the bridge deck (m): "; cin
>> thickness; deadLoad = DeadLoad(length,
width) * thickness * CONCRETE_DENSITY * 9.81;
cout << "The estimated dead load is: " <<
deadLoad << " N" << endl; break; case 2: cout <<
"Enter the length
of the bridge (m): "; cin >> length; cout << "Enter
the width of the bridge (m): "; cin >> width;
liveLoad = LiveLoad(length, width); cout << "The
estimated live load is: " << liveLoad << " N" <<
endl; break; case 3: cout << "Enter the width of the
bridge (m): "; cin >> width; windLoad =
WindLoad(width); cout << "The estimated wind
load is: " << windLoad << " N" << endl; break;
case 4: cout << "Enter previously calculated Dead
Load (N): "; cin >> deadLoad; cout << "Enter
previously calculated Live Load (N): "; cin >>
liveLoad; cout << "Enter previously calculated
Wind Load (N): "; cin >> windLoad; maxLoad =
MaximumLoad(deadLoad, liveLoad, windLoad);
cout << "The maximum load capacity is: " <<
maxLoad << " N" << endl; break; case 5: cout <<
"Thank you for using the Bridge Load Analysis
System!" << endl; return 0; default: cout << "Invalid
choice. Please select between 1 and 5." << endl; }
cout << "Do you want to perform another
calculation? (Y/N): "; cin >> confirm; } cout <<
"Thank you for using the Bridge Load Analysis
System!" << endl; return 0; } // Function to display
the menu void DisplayMenu() { cout << "\n1.
Calculate Dead Load" << endl; cout << "2.
Calculate Live Load" << endl; cout << "3. Calculate
Wind Load" << endl; cout << "4. Determine
Maximum Load Capacity" << endl; cout << "5.
Exit" << endl; } // Function to calculate Dead Load
double DeadLoad(double length, double width)
{ return length * width; } // Function to calculate
Live Load double LiveLoad(double length, double
width) { return length * width *
LIVE_LOAD_INTENSITY; } // Function to calculate
Wind Load double WindLoad(double width)
{ double height, velocity, dragCoefficient; cout <<
"Enter the height of the bridge deck (m): "; cin >>
height; cout << "Enter the wind velocity (m/s): "; cin
>> velocity; cout << "Enter the drag coefficient
(typically 1.2 to 2.0): "; cin >> dragCoefficient;
double area = height * width; return
AIR_DENSITY_CONSTANT * pow(velocity, 2) *
dragCoefficient * area; } // Function to calculate
Maximum Load Capacity double
MaximumLoad(double DL, double LL, double WL)
{ double factorOfSafety; cout << "Enter the factor
of safety (1.5 - 2.0): "; cin >> factorOfSafety; return
factorOfSafety * (DL + LL + WL); }
Notes:
1. All inputs are requested within the relevant
function or case.
2. Gravity (9.81 m/s²) is used to convert mass to
force (for Dead Load).
3. The program allows repeat calculations until the
user exits.
4. Comments are provided for clarity, and constants
are defined for clarity and easy editing.
Let me know if you want a GUI version or need
this integrated with file input/output or a database.

You might also like