I need help in C++

+3 leo interisti · January 16, 2015
INTRODUCTION TO ALGORITHMS AND PROGRAMMING
Homework2 Questions
 
What floor are they?
     Mr. Arbi Cela works in National Post Services. He distributes mails to the people. Sometimes he goes to apartments buildings and has to find out the floor number from the apartment number. Write a program that will find out the floor number from the given data.
 
Input Specifications: You will be given 3 integer numbers
?     n: the number of apartments in this building
?     m: the number of apartments in every floor
?     k: starting floor number for the apartments
where 0 <= n <= 50, 1 <= m <= 10,  -3 <= k <= 5. Then the following line, you will be given n space separated apartment numbers which are between 1 and 1000.
 
Output Specifications: show n space-separated integers: the floor numbers for every apartment given.
 
Sample Input
4 6 3
32 3 22 17
 
Sample Output:
8 3 6 5
 

Post a Reply

Replies

Oldest  Newest  Rating
+3 Mathias Frits Rørvik · January 25, 2015
No one is going to do your homework for you.
+1 Matt Belle · January 30, 2015
the floor number = (the apartment number / m) + k
0 mag magz · January 30, 2015
@ leo interisti 
You need to navigate to:  http://www.cplusplus.com/forum/articles/12974/

Enjoy.
  • 1

C++

107,312 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator