+ 1

Binary matrix building

Hello everyone, I have bad english, but I hope you will understand my problem. I have a task to create algorithm to build binary matrix for N variables, using only "for" loops and dynamic arrays. For example: We ask user to enter the N variable User enters 3 Program displays: 1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 I hope you get it. I have my own code, but it always get an error in VS. Here the link on my code https://code.sololearn.com/c8Q01ipCY76o/#cpp

16th Dec 2019, 11:21 AM
Artem
Artem - avatar
13 odpowiedzi
+ 1
Truly, it is a truth table for Boolean function, and the right column enters the user. There will be the 0 and 1 for users function. So, why don't fill matrix horizontally? I don't know how XD. Btw thanks for answering.
16th Dec 2019, 1:34 PM
Artem
Artem - avatar
+ 1
Thank you, u really helped me
16th Dec 2019, 2:22 PM
Artem
Artem - avatar
+ 1
Your code is Ok you just miss to include cmath header and thats all Just #include <cmath> On the top of your code and it will work perfectly
17th Dec 2019, 9:13 PM
$p@rK
$p@rK - avatar
0
Share your code here.
16th Dec 2019, 11:22 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
Yes, I added a code, so you can see that program works for n≤3, but for bigger n it crashes because of some memory troubles. I can't solve this for 3 days, so I have to ask for help.
16th Dec 2019, 11:39 AM
Artem
Artem - avatar
0
It's look good, but I need whole matrix, coz I build sknf/sdnf using this matrix. I thought I should tell this all from the start, so sorry for it. But anyway thanks for help, think I can do smth with your advices.
16th Dec 2019, 2:15 PM
Artem
Artem - avatar