# Answer to Question #5675 in C++ for Damar L. Ellis

Question #5675

Mr. Roper owns 20 apartment buildings. Each building contains 15 units that he rents for $800 per month each. Design the application that would print 12 payment coupons for each of the 15 apartments in each of the 20 buildings. Each coupon should contain the building number (1 through 20), the apartment number (1 through 15), the month (1 through 12), and the amount of rent due.

Expert's answer

C++:

Mr. Roper owns 20 apartment buildings. Each building contains 15 units that he rents for $800 per month each. Design the application that would print 12 payment coupons for each of the 15 apartments in each of the 20 buildings. Each coupon should contain the building number (1 through 20), the apartment number (1 through 15), the month (1 through 12), and the amount of rent due.

# include<iostream.h>

# include<conio.h>

int b,a,m,r;

void printform(int b, int a, int m, int r){ //a is an apartment number, b is a number of building, m is a month, r is a rent

cout<<"Building No: "<<b<<"\nApartment number: "<<a<<"\nMonth: "<<m<<"\nRent: "<<r<<"\n\n";

}

void main(){

r = 800;

for (b=1;b<=20;b++){

& for (a=1;a<=15;a++){

& for (m=1;m<=12;m++){

& printform(b, a, m, r);

& }

& }

}

}

Mr. Roper owns 20 apartment buildings. Each building contains 15 units that he rents for $800 per month each. Design the application that would print 12 payment coupons for each of the 15 apartments in each of the 20 buildings. Each coupon should contain the building number (1 through 20), the apartment number (1 through 15), the month (1 through 12), and the amount of rent due.

# include<iostream.h>

# include<conio.h>

int b,a,m,r;

void printform(int b, int a, int m, int r){ //a is an apartment number, b is a number of building, m is a month, r is a rent

cout<<"Building No: "<<b<<"\nApartment number: "<<a<<"\nMonth: "<<m<<"\nRent: "<<r<<"\n\n";

}

void main(){

r = 800;

for (b=1;b<=20;b++){

& for (a=1;a<=15;a++){

& for (m=1;m<=12;m++){

& printform(b, a, m, r);

& }

& }

}

}

## Comments

## Leave a comment