Help!! I am lost

Write a C++ program that will ask the user for two positive integers a and b. You may assume that both a and b are in the set { 0, 1, 2, ..., 999} and that a < b.

The user will then be prompted to enter divisors (zero or more). You may assume that all divisors are in the set { 1, 2, 3, ..., 999}. The user will be prompted to add a divisor until the user indicates that they are finished. This will be done by entering -1. You may assume that the user enters from zero to at most four divisors followed by -1 to terminate the list.

Finally, your program should output a matrix with the following elements.

An M in the upper left corner.
The first row, after the M, will contain the divisors in input order.
The first column after the M will contain all integers from a to b-1 in increasing order.
A 1 at row i+1 and column j+1 if the i-th integer is divisible by the j-th divisor, otherwise a 0.
Matrix elements should be separated by a space.

Sample Run
a: 1
b: 16
Add divisor: 2
Add divisor: 3
Add divisor: -1
M 2 3
1 0 0
2 1 0
3 0 1
4 1 0
5 0 0
6 1 1
7 0 0
8 1 0
9 0 1
10 1 0
11 0 0
12 1 1
13 0 0
14 1 0
15 0 1

Do you guys know how to finish it
I know how to start.
That would be by posting the code that you currently have (use the "<>" button to format it as source code) and describing the problem that you encounter in your own words. It will make the answers you get so much more useful.

If you are working on the same assignment as Luke1345 (http://www.cplusplus.com/forum/beginner/199681/), kindly combine the topics.
Last edited on
@Nico
The link you gave me cannot be found. The site says : "Page Not Found"
That's because the training bracket and comma has been added to the end of the URL. Simply use the same URL, but without the final bracket and comma.
Topic archived. No new replies allowed.