I have a program to try to solve this Codeforces question -> https://codeforces.com/problemset/problem/1625/A
However, when I run the code an error pops up. This is my code:
#include<iostream>
#include<bitset>
#include<math.h>
using namespace std;
int main (){
int tests;
string aray[10000];
cin >> tests;
for(int a; a < tests; a++){
int words, letters;
cin >> words >> letters;
for(int b; b < words; b++){
int x;
cin >> x;
string binary = bitset<32>(x).to_string;
aray[b] = binary;
}
int zeros, ones, total;
for(int c; c < 32; c++){
for(int d; d < words; d++){
if(aray[d][c] = '0'){
zeros++;
}else{
ones++;
}
}
if(zeros < ones){
total = total + pow(2, 31-c);
}
}
cout << total;
}
}
I tried searching up solutions, but I just couldn't understand or find any solutions that helped me. Can you tell me why this happens and how to fix it? Thanks! I've just started C++ and am not too familiar with syntax.