So I wrote out my code, and yes there is probably a better way I could have done it, but I'm not going for awesome. I just want to get it done. I was almost done and one of my variables came out (pointer-to-). I tried to define in as float, int, and double but nothing worked. Now I'm stuck. Any suggestions? Its on line 28, the second while in my "int main()" section. RoomTiles = RoomTiles + RoomTiles(RoomNumb); Thanks in advance!
Code:#include <cmath> #include <iomanip> #include <iostream> using namespace std; //Function prototypes void GetRoomNumb (float& RoomNumb); void GetRoomTiles (double& RoomTiles); void GetBoxAmt (float& BoxAmt, float& Extra); int main() { //Variable Declarations float RoomNumb; double RoomTiles; float BoxAmt; float Remainder; GetRoomNumb(RoomNumb); while (RoomNumb > 0) { GetRoomTiles(RoomTiles); std :: cout << "Room requires " << RoomTiles << " tiles." << endl; while (RoomNumb > 0) { RoomTiles = RoomTiles + RoomTiles(RoomNumb); } RoomNumb--; } GetBoxAmt(BoxAmt, Remainder); std :: cout << "Total tiles required is " << RoomTiles << "." << endl << "Number of boxes needed is " << BoxAmt << "." << endl << "There will be " << Remainder << " tiles." << endl; return 0; } //********************************************************************************************************** void GetRoomNumb (float& RoomNumb) { std :: cout << "Enter number of rooms: "; std :: cin >> RoomNumb; } //********************************************************************************************************** void GetBoxAmt (int& BoxAmt, int& Remainder) { double RoomTiles; GetRoomTiles(RoomTiles); BoxAmt = RoomTiles / 20; Remainder = BoxAmt % 20; if (Remainder = 0) { BoxAmt = BoxAmt; Remainder = 0; } else { BoxAmt = BoxAmt + 1; Remainder = BoxAmt % 20; } } //********************************************************************************************************** void GetRoomTiles (double& RoomTiles) { //Variable Declarations int WidthFeet; int LengthFeet; int WidthInches; int LengthInches; int TileInches; int TotalWidthInches; int TotalLengthInches; int WidthTiles; int LengthTiles; int Remainder; int Corner; int WidthTile2; int LengthTile2; //Get Values std :: cout << "Enter size of tile in inches: "; std :: cin >> TileInches; std :: cout << endl; std :: cout << "Enter room width (feet and inches, separated by a space): "; std :: cin >> WidthFeet >> WidthInches; std :: cout <<endl; //Calculate Width TotalWidthInches = WidthFeet * 12 + WidthInches; WidthTiles = TotalWidthInches / TileInches; Remainder = TotalWidthInches % TileInches; if (Remainder = 0) { WidthTile2 = 0; Corner = Corner + 0; } else { WidthTile2 = WidthTiles; Corner++; } //Calculate Length TotalLengthInches = LengthFeet * 12 + LengthInches; LengthTiles = TotalLengthInches / TileInches; Remainder = TotalLengthInches % TileInches; if (Remainder = 0) { LengthTile2 = 0; Corner = Corner + 0; } else { LengthTile2 = LengthTiles; Corner++; } //Calculate Total Tiles RoomTiles = (WidthTiles * LengthTiles) + (WidthTile2 + LengthTile2) + Corner; }



LinkBack URL
About LinkBacks



