I am working on a triplet code actually. The problem statement goes as follow: The task is to find their comparison points by comparing a[0] with b[0], a[1] with b[1], and a[2] with b[2].
If a[i] > b[i]
, then Alice is awarded 1 point.
If a[i] < b[i]
, then Bob is awarded 1 point.
If a[i] = b[i]
, then neither person receives a point.
Comparison points is the total points a person earned.
The result has to be a two valued array.
The code appears correct and fine to me, but iam not getting the desired and correct output.
Somebody please help.
The code i wrote is as follow:
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(){
int a[3];
int b[3];
int r[2] = {r[0],r[1]};
r[0]=0;
r[1]=0;
cin>>a[3]>>b[3];
for(int i=0;i<3;i++){
if(a[i] >b[i]){
r[0]=r[0]+1;
}else if(b[i]>a[i]){
r[1] = r[1]+1;
}else{
r[0]=r[0]+0;
r[1]=r[1]+0;
}
}
cout<<r[0]<<" "<<r[1];
}