I was doing the problem Young Physicist here and I got this compilation error when I did:
Can’t compile file:
program.c:1:20: fatal error: iostream: No such file or directory
compilation terminated.
This is the code I used when submitting and it works locally on my computer with the test cases so I’m not sure what’s wrong. Could someone please explain my mistake here? Thanks!
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
int x, y, z;
vector <int> a(n), b(n), c(n);
for (int i = 0; i <n; i++){
cin >> x;
a[i] = x;
cin >> y;
b[i] = y;
cin >> z;
c[i] = z;
}
int sum1 = 0;
for (int i = 0; i < n;i++){
sum1 += a[i];
}
int sum2 = 0;
for (int i = 0; i < n;i++){
sum2 += b[i];
}
int sum3 = 0;
for (int i = 0; i < n;i++){
sum3 += c[i];
}
if (sum1 == 0 && sum2 == 0 && sum3 == 0) cout << "YES" << endl;
else cout << "NO" << endl;
}