读后请说明程序的功能,并对每条语句进行注释,说明其作用。


#include <iostream>

using namespace std;

int fun(char str[ ])

{

    int n = 0, num = 0;

    while (str[n] != ‘\0’)

    {

        if (str[n] >= ‘A’ && str[n] <= ‘Z’ ||

            str[n] >= ‘a’ && str[n] <= ‘z’)

            num++;

        n++;

    }

    return num;

}

int main( )

{

    cout << fun( “123 abc ABC” ) << endl;

    return 0;

}




yuantongxin
浏览 1761回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP