Thread: need to calculate it tonight

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    2

    Exclamation need to calculate it tonight

    I need to calcualate the maximum safe depth a diver can dive. this is the information i have....
    pressure increases 4.3lbs/(in*in) for every 10ft of descent
    pressures of more than 65lbs/(in*in) are dangerous

    Can anyone help me find the depth, i have the rest of the program ready...but i cant do the calculations



    #include <iostream> // for input and output
    #include <string> // for strings
    using namespace std;


    //constant declarations
    //all variables are named constants, no input needed
    const string TITLE = "Maximum Safe Diving Depth for Non-Professional Divers"; // title



    int main()
    {

    //Variable
    float inch = 12; // inches
    float pressureIncrease = 4.3 / (inch * inch); // pressure increases
    float pressureMax = 65 / (inch * inch); // dangerous pressure level


    // Processing
    float safeDepth =

    // Output
    cout << endl << endl; // prints 2 lines
    cout << TITLE << endl << endl; // prints title
    cout << "Maximum Safe Diving Depth is: " << safeDepth << " feet"
    << endl << endl;

    return 0;

    } //end of program

  2. #2
    Unregistered
    Guest
    this is a relatively simple question.. are you sure you haven't thought about this yourself?

    Code:
    float feetPerIncrease = 10.0;
    float safeDepth = pressureMax / pressureIncrease * feetPerIncrease;

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    damn! i hate it when the board doesn't know it's me bloody cookies!

    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    2

    thanks

    thanks a ton
    i guess i am too tired to think....but you are right it was purty easy!
    Thanks again!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Right Triangle Program
    By BSmith4740 in forum C# Programming
    Replies: 9
    Last Post: 02-27-2008, 12:24 AM
  2. how to calculate all files in disk?
    By kirmelyte in forum C Programming
    Replies: 1
    Last Post: 04-30-2006, 02:47 PM
  3. attempting to calculate e with spigot algorithm
    By eehiram in forum C Programming
    Replies: 13
    Last Post: 04-13-2006, 01:38 AM
  4. Small program that has to calculate miles per gallon
    By Guti14 in forum C++ Programming
    Replies: 6
    Last Post: 01-06-2004, 02:47 PM