giving write output on my compiler but stii gives wrong ans here

#include
#include <bits/stdc++.h>
using namespace std;
int fun(int n);
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
try{
for(int i=0;i<t;i++){
int n;
cin>>n;
fun(n);
}
}
catch(exception& e){}

return 0;
}
int fun(int n){
string arr[n];
for(int j=0;j<n;j++){
cin>>arr[j];
}
sort(arr, arr+n);
for(int i=0;i<n;i++){
for(int j=0;j<arr[i].length();j++){
if(arr[i][j]==‘f’||arr[i][j]==‘d’){
arr[i][j]=‘1’;
}else arr[i][j]=‘0’;
}
}
float sum=0.2;
float arrsum[n];
for(int i=0;i<n;i++){
for(int j=1;j<arr[i].length();j++){
if(arr[i][j]==arr[i][j-1]){
sum=sum+0.4;
}else sum=sum+0.2;
}
if(arr[i]==arr[i+1]){
sum=sum/2;
}
arrsum[i]=sum;
sum=0.2;
}
float a=0;
for(int i=0;i<n;i++){
a+=arrsum[i];

}
int result=a*10;
 cout<<result;

}

could be error in typecasting double into integer as was in my code.

//