#include "stdafx.h"
#include<iostream>
using namespace std;
int number1(float X,float Y,float Size)
{
float num;
num=(X*12+Y)/Size;
if(int(num)==num)
return int(num);
else
return int(num)+1;
}
void number2(int X,int&a,int&b)
{
float A;
A=X/20.0;
if(int(A)==A)
{a=int(A);}
else
{a=int(A+1);}
b=20*a-X;
return;
}
int main(int argc, char* argv[])
{
int n,num1,num2,Num=0,i=0;
float Size;
cout<<"enter number of rooms and size of tile in inches."<<'\n';
cin>>n>>Size;
while(i<n)
{
float w,W,l,L;
cout<<"enter room width in feet and inches,separated by a space"<<endl;
cin>>W>>w;
num1=number1(W,w,Size);
cout<<"enter room length"<<endl;
cin>>L>>l;
num2=number1(L,l,Size);
cout<<"Room requires "<<num1*num2<<'.'<<endl;
Num=Num+num1*num2;
i++;
}
cout<<"Total tiles required is "<<Num<<endl;
int box,extra;
number2(Num,box,extra);
cout<<"Number of boxes needed is "<<box<<endl<<"There will be "<<extra<<" extra tiles"<<endl;
return 0;
}