Jump to content

Algorithm help for c++

- - - - -

  • Please log in to reply
3 replies to this topic

#1
Shock5008

Shock5008

    Newbie

  • Members
  • Pip
  • 2 posts
I did all my algorithms already but i need help on this one that is giving me problems.

Design an algorithm that prompts the user to enter the square footage of a house block and the square footage of a house that has been built on the block. The algorithm should then compute and display the mowing time required to cut the grass around the house, at the rate of two square meters per minute.

#2
Shock5008

Shock5008

    Newbie

  • Members
  • Pip
  • 2 posts
the program being used is c++

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What part of it do you need help with? The statement of the problem seems a little vague to me.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Zer033

Zer033

    Learning Programmer

  • Members
  • PipPipPip
  • 79 posts
I think this is what you're asking.

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    int bSqF;
    int hSqF;
    int mSqF;
    double mPerMin;
    double mowInM;
    int answerMinutes;

    mPerMin = 2*0.09290304;

    cout << "Enter the block square footage: ";
    cin >> bSqF;
    cout << "\nEnter the house square footage: ";
    cin >> hSqF;

    mSqF = bSqF - hSqF;

    mowInM = mSqF * 0.09290304;

    answerMinutes = mowInM/mPerMin;

    cout << "\nIt would take about " << answerMinutes << " minutes to mow the lawn";
    
    return 0;
}





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users