简单查找小写字母

#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cctype>
using namespace std;
int main()
{
    char arr[100];//读入数组肯定char不用想的 
    int lower;//计数器,记录小写字母 
    cout<<"请输入字符串:";
    cin.getline(arr,100);//这句话是重点,我之前写的是cin>>arr,明显后续无法读入字符串,这个要记住,以及记住头怎么写 
    int len=strlen(arr);//这个是i的长度,从0到数组的最后一个 
    for(int i=0;i<len;i++)

     if(islower(arr[i])!=0)
     lower++;

cout<<lower;
return 0;
 } 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章