Maximum subarray sum

the description of the test reads_emphasized text_ "You are given a one dimensional array that may contain both positive and negative integers, find the sum of contiguous subarray of numbers which has the largest sum. For example, if the given array is {-2, -5, 6, -2, -3, 1, 5, -6}, then the maximum subarray sum is 7. "emphasized text
I am not able to understand how the sum is when it should be 6.
Also I made a program but it shows wrong answer so i think i am not able to understand the problem.

My code is as follows
#include
#include
#include
using namespace std;
int main() {
long long int n;
cin>>n;
for(long long int k=0;k<n;k++){
long long int t;
cin>>t;
long long int a[t];
for(long long int i=0;i<t;i++){
cin>>a[i];
}
long long int Max=0;
long long int sum=0;
long long int start;
long long int start_step=0;

while(start_step<t){
    if(a[start_step]>0){
        sum+=a[start_step];
    }
    if(sum>Max){
        Max=sum;
    }
    else if((a[start_step]<0)){
        sum=0;
    }
    start_step++;
}
cout<<Max<<endl;

}

}

@Puneet_kr_shin
If you take the subarray { 6. -2. -3. 1. 5 } , the sum is 7 which is the maximum subarray sum for the given array.
Your approach is wrong for this problem. Three different approaches each with a different time complexity have been discussed in the course with their codes. The best approach being the Kadane’s algorithm which works in O(n) time. Kindly refer to them.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.