001

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>
using namespace std;
#define N  7
int fun(char s[],char a,int n){
    int j;
    j=n;
    while(a<s[j]&&j>0)j--;
        return j;
}

int main(){
    char s[N+1];
    int k;
    for (k = 1; k <=N; k++)
        s[k]='A'+2*k+1;
    cout<<fun(s,'M',N)<<endl;
}
Scroll to Top