I'm not understanding what's wrong with my code. Maybe I am misunderstanding the requested format for the output, but here is my code:

class Solution {

public:

vector<int> twoSum(vector<int>& nums, int target) {

```
// The 2 variables below are used to mark the desired values that add up to the target
int x,y;
x=0;
y=0;
int max = nums.size();
// The 2 variables below are what will be used for the output
int answerA, answerB;
answerA=0;
answerB=0;
bool found = false;
while (found == false){
for(int a = 1; a <= max ; a++){
for(int b = 1; b <= max ; b++){
if(nums[a] + nums [b] == target){
found = true;
x = a;
y = b;
}
if(found)
break;
}
if(found)
break;
}
}
if(nums[x] < nums[y]){
answerA = x;
answerB = y;
}
else if(nums[y] < nums[x]){
answerA = y;
answerB = x;
}
cout << "index1=" << answerA << ", index2=" << answerB << endl;
}
```

};