(C++)给出一个字符串,统计出字符串中大写字母的数量,输出该字符串并在字符串的后面输出同等数量的感叹号!

2025-03-13 16:30:48
推荐回答(1个)
回答1:

#include
using namespace std;
#define M 1000
#define N 101
void main()
{
    int T,i,j;
    char str[M][N];
    int count[M];
    while(cin>>T)
    {
        getchar();
        for(i=0;i        {
            count[i]=0;
            gets(str[i]);
            j=0;
            while(str[i][j])
            {
                if(str[i][j]>='A' && str[i][j]<='Z')
                    count[i]++;
            j++;
            }
        }
        for(i=0;i        {
            cout<        for(j=0;j            cout<<"!";
        cout<        }
    }
}