Posts by Israel Andrade • 11 points
2 posts
-
0
votes1
answer52
viewsA: How to Count Integers Repeated Every 5 Values in an OR Vector to Each Row of a Table (Two-Dimensional Matrix, Example: matrix[3][5] ) C++
I found myself the answer to three possibilities: 1º (from the vector): int contador5 = 0; int k = 5; int l = 0; for (int i = 0; i <= 10; i += 5) { for (int j = i; j < k; j++) { if(vetor [j]…
-
0
votes1
answer52
viewsQ: How to Count Integers Repeated Every 5 Values in an OR Vector to Each Row of a Table (Two-Dimensional Matrix, Example: matrix[3][5] ) C++
I have a vector that only has integers 1 and 2 randomly allocated. Example: int vetor[15] = {1,1,1,2,2,1,1,2,2,2,1,1,1,2,1}; How the vector would be printed: 1 1 1 2 2 1 1 2 2 2 1 1 1 2 1 I have…