Using the codes in computational language in C++ it is possible to write a code that complete the function FindLastIndex() that takes one string parameter and one character parameter.
<h3>Writting the code:</h3>
<em>#include <iostream></em>
<em>using namespace std;</em>
<em />
<em>int </em><em>FindLastIndex</em><em>(string inputString, char x)</em>
<em>{</em>
<em> // running a for loop that iterates the inputString from the last index and comes down to the 0th index. We are iterating from the last index because we want to find the last character such that it is not equal to x. So iterating the string from last makes more sense because we will find the value faster as compared to searching from the front to get that last value.</em>
<em> for (int i = </em><em>inputString</em><em>.length() - 1; i >= 0; i--) {</em>
<em> // if current character not equals the character x then return the index</em>
<em> if (inputString[i] != x) {</em>
<em> return i;</em>
<em> }</em>
<em> }</em>
<em />
<em />
<em> // if the above loop didn't return an index, then all the characters are same in the string, hence return -1</em>
<em> return -1;</em>
<em>}</em>
<em />
<em>int main()</em>
<em>{</em>
<em> string </em><em>inString</em><em>;</em>
<em> char x;</em>
<em> int result;</em>
<em />
<em> cin >> inString;</em>
<em> cin >> x;</em>
<em />
<em> result = </em><em>FindLastIndex</em><em>(inString, x);</em>
<em />
<em> cout << result << endl;</em>
<em />
<em> return 0;</em>
See more about C++ at brainly.com/question/29225072
#SPJ1