i made a simple code for a problem solving question but the result is weird for me here is the code:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,num;
string opr;
cin>>n;
num = 0;
for(int i = 1; i <= n; i++){
cin>>opr;
if(opr.find("++"))
{
num+=1;
}
else if(opr.find("--"))
{
num-=1;
}
}
cout<<num;
}
if i input n as number "1" it actually subtract and the result is -1 but if i inserted n as 2 or more it works fine what is happening?