1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void CalcuateTiles (int tileSize,int roomWidthFeet,int roomWidthInch,int roomLengthFeet,int roomLengthInch, float& numTiles);
void DeterminTileAmont (float numTiles, float tileTotal, float boxTotal, float leftTiles);
int main()
{
int numRooms, tileSize,roomWidthFeet,roomWidthInch,roomLengthFeet,roomLengthInch;
float numTiles = 0;
float leftTiles = 0;
float tileTotal = 0;
float boxTotal = 0;
cout << "Enter numbers of Rooms beeing tiled"<< endl;
cin >> numRooms;
cout << "Enter inch size of Tile used for job" << endl;
cin >> tileSize;
for (int count = 1; count <= numRooms; count++)
{
cout << "Enter Rooms width in feet and inches (sepreat numbers with a space)" <<endl;
cin >> roomWidthFeet >> roomWidthInch;
cout << "Enter Room length in feet and inches (sepreat numbers with a space)" <<endl;
cin >> roomLengthFeet >> roomLengthInch;
CalcuateTiles (tileSize,roomWidthFeet,roomWidthInch,roomLengthFeet,roomLengthInch,numTiles);
}
DeterminTileAmont (numTiles,tileTotal, boxTotal,leftTiles);
cin.get();
cin.get();
return 0;
}
void DeterminTileAmont (float numTiles, float tileTotal, float boxTotal,float leftTiles)
{
tileTotal= numTiles;
boxTotal = tileTotal / 20;
leftTiles = (boxTotal * 20) - tileTotal;
cout << "Total tiles requierd for job is: " << tileTotal << endl;
cout << "Number of boxes nedded is: " << boxTotal << endl;
cout << "Tiles left are: " << leftTiles << endl;
}
void CalcuateTiles (int tileSize,int roomWidthFeet,int roomWidthInch,
int roomLengthFeet,int roomLengthInch,float& numTiles)
{
float sumWidth;
float sumLength;
sumWidth = ((roomWidthFeet *12) + roomWidthInch) / tileSize;
sumLength = ((roomLengthFeet*12) + roomLengthInch) / tileSize;
numTiles = (sumWidth + 1) * (sumLength + 1);
cout << "The Room requiers " << numTiles << " Tiles" << endl;
}
|