第十三周上机项目5--(2) 字符串复制

来源:互联网 发布:图像矩阵有负值 编辑:程序博客网 时间:2024/05/20 11:48
/* *Copyright (c) 2014,烟台大学计算机学院 *All gight reserved. *文件名称:temp.cpp *作者:曹莉萍 *完成时间:2014年11月25日 *版本号:v1.0 *程序描述:字符串的复制功能 *输入描述:输入一段字符串 *程序输出:字符串中英文字母大小写的统计数*/#include<iostream>#include<cstdio>using namespace std;int main(){    char str[50];    int i=0,n=0,m=0;    cout<<"输入字符串:";    gets(str);    while(str[i]!='\0')    {        if (str[i]>=65 && str[i]<=90)            n++;        else if (str[i]>=97 && str[i]<=122)            m++;        i++;    }    cout<<"其中的大写字母的个数是: "<<n<<endl<<"小写字母的个数是:"<<m;    return 0;}

运行结果


0 0