line 6 you call the second argument numberOfTiles and on line 44 you call it numOfTiles.
Also, why did you make the function void, and why did you pass the first argument by reference? It doesn't look like your changing its value in the function. Why don't you just declare the function as int getTiles(int tileSize) and have it return numOfTiles as an integer?
long double main is right. I think you meant to initialize x to 1, not rooms.
Also, I noticed in the for loop that you wrote totalTiles=numOfTiles+lastTileNum;, yet you initialized both numOfTiles and lastTileNum to 0. You have to realize that the variable numOfTiles in the function getTiles is not the same as the variable numOfTiles in the main function, even though you gave them the same name. The function getTiles does not change either the value of numOfTiles or lastTileNum in the main function, so basically line 28 always gives totalFiles a value of 0. It changes the value of totalTiles since that is the variable that you pass by reference on line 27, and that is the only argument that you modify in the function (Again, I don't understand why you passed tileSize by reference).
On line 27, perhaps you meant to pass numOfTiles as the second argument, and not totalTiles? THAT would change the value of numOfTiles in the main function.
Furthermore, you should reconsider your calculations. Are the tiles square? If so, then shouldn't line 61 say numOfTiles=area/(tileSize*tileSize);? What if this number doesn't divide evenly? For instance, what if area is equal to 50 and tileSize is equal to 2? 50/(2*2)=12.5. Since you declare numOfTiles as an integer, 12.5 will round down to 12, the nearest integer. But don't you really need 13 tiles?
#include <iostream>
#include <iomanip>
#include <string>
usingnamespace std;
void getTiles(int& tileSize, int& numOfTiles);
int main()
{
/*************** Variables ******************/
int rooms;
int tileSize;
int numOfTiles;
int totalTiles;
int extraTiles;
int numOfBoxes;
int lastTileNum = 0; //Used to store the last room tile number
/*********** Get Number of Rooms ***********/
cout << "Enter number of rooms" << endl;
cin >> rooms;
/************ Get Size of tiles ************/
cout << "Enter tile size in inches" << endl;
cin >> tileSize;
/*************** Main Loop ******************
* This loop will aks for the size of the room(s)
* and calculate the number of tiles needed.
********************************************/
int x = 1;
for (x; x <= rooms; x++)
{
/************* Room Lable **************/
if (x >= 1 && x <= rooms)
cout << endl << "-Room " << x << "-" << endl;
getTiles(tileSize, numOfTiles);
totalTiles = numOfTiles + lastTileNum;
lastTileNum = numOfTiles;
}//EOMain Loop
/*********** Get Number of Boxes ***********/
numOfBoxes = totalTiles/20;
if (totalTiles%20 > 0) // rounds up
numOfBoxes++;
extraTiles = numOfBoxes * 20 - totalTiles; //Gets left over tiles
/************ Out Print to User ************/
cout << endl;
cout << "The total tiles required for all rooms is " << totalTiles << "." << endl;
cout << "The number of box of tiles needed is " << numOfBoxes << "." << endl;
cout << "There will be " << extraTiles << " extra tiles." << endl;
system("PAUSE");
return 0;
}//EOMain
/********** Room Calculation Function **********/
void getTiles(int& tileSize, int& numOfTiles)
{
/************** Variables ******************/
int roomArea;
int widthFeet;
int lenghtFeet;
int widthInches;
int lengthInches;
/*********************** Get Dimensions of Rooms ****************************/
cout << "Enter room width (feet and inches, separated by a space)" << endl;
cin >> widthFeet >> widthInches;
widthInches = widthFeet * tileSize + widthInches; //turns feet/inches into just inches
cout << "Enter room length (feet and inches, separated by a space)" << endl;
cin >> lenghtFeet >> lengthInches;
lengthInches = lenghtFeet * tileSize + lengthInches; //turns feet/inches into just inches
/************** The Math ******************/
roomArea = widthInches * lengthInches;
numOfTiles = roomArea/(tileSize*tileSize);
if (roomArea%tileSize > 0) // adds a box even if there is only 1 extra tile needed.
numOfTiles ++;
cout << "This room requires " << numOfTiles << " tiles." << endl;
}//EOgetTiles