can anyone give me help with solving an equation with Cpluspus

Discussion in 'C++' started by countrygirl, Oct 30, 2007.

  1. countrygirl

    countrygirl New Member

    Joined:
    Oct 30, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    i have to write a program that will compute the amount someone will have to pay for a parcel of land...

    Input: The Length and Width in feet
    Price Per Acre

    Extra information: 1 acre=43560 sq ft.

    Calculation:
    Total area in square feet.
    Total acreage
    total amount of the sake

    Output:
    total area in square feet
    total acreage
    total amount of the sale


    i am so confused on how to do this...i have read all of the tutorials on cplusplus and am using microsoft visual studios to do it

    i put in #include "stdafx.h"
    #include<iostream>
    using namespace std;

    im kind of confused what to put after int...i thought it should be like length and width...i think i have to make up a value for something

    can anyone help me??
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    You need a book which can help you with the Hello world program because you don't put int after you code but you should start with the main function.
     
  3. countrygirl

    countrygirl New Member

    Joined:
    Oct 30, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    i dont need a hello world program- im taking a computer program class and i need to write a program- i actually figured all of it out except how to calculate the amount
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    But the first post sounded like what you should be putting after the #include.
     
  5. countrygirl

    countrygirl New Member

    Joined:
    Oct 30, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    oh im sorry...i did put that before all of that- i was just unsure what to put after that...I have
    double Length,
    Width,
    Price,
    Acres,
    Sq_Feet,
    Amount;
    and i have the cin's and cout's

    the only thing i cant figure out is what to put the amount equal to in order to build it and get a reply
     
  6. Lief Webster

    Lief Webster New Member

    Joined:
    Oct 16, 2007
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    0
    I'm not sure exactly what you want, but your program might look something like this:

    Code:
    //Price per Parcel
    
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        int length , width , price , sq_feet , total , acreage;
        
        //Use cout to ask user for length
        cin >> length;
        
        //Use cout to ask user for width
        cin >> width;
        
        //Use cout to ask for the price per square foot
        cin >> price;
        
        length * width == sq_feet;
        
        acreage = sq_feet / 43560;
        
        total = sq_feet * price;
        
        //Send sq_feet to cout
        //Send acreage to cout
        //Send total (price) to cout
    
        return 0;
    }
    Maybe if you explain it a little better it would be easier to help. (Sorry, I think I'm sounding a bit like shabbir in saying that.)
     
  7. countrygirl

    countrygirl New Member

    Joined:
    Oct 30, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    thank you...yes i should have tried to explain more what i was trying to do
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice