字符串字符个数统计解决方法

字符串字符个数统计
#include<iostream>
using namespace std;
void main()
{
char ch,str1[30];
int i = 0,j =0, len,value = 0;
cout << "input the string:" << endl;
cin >> str1;
len = strlen(str1);
ch = str1[i];
while(ch != '\0')
{
while(j < len)
{
if(ch = str1[j])
value++;
j++;
}
cout << "the number of "<<ch<< "is:"<<value<<endl;
ch = str1[++i];
}
}


------解决方案--------------------
看不懂,你在做啥?有啥问题?
------解决方案--------------------
C/C++ code
#include<iostream>
using namespace std;
void main()
{
char ch,str1[30]={0};
int i = 0,j =0, len,value = 0;
cout << "input the string:" << endl;
cin.getline(str1,30);
len = strlen(str1);
ch = str1[i];
while(ch != '\0')
{
while(j < len)
{
if(ch = str1[j])
value++;
j++;
}
cout << "the number of "<<ch<< "is:"<<value<<endl;
ch = str1[++i];
}
}

------解决方案--------------------
[code=C/C++][/code]
#include<iostream>
using namespace std;
void main()
{
char ch,str1[30]={0};
int i = 0,j =0, len,value = 0;
cout << "input the string:" << endl;
cin.getline(str1,30);
len = strlen(str1);
ch = str1[i];
while(ch != '\0')
{
while(j < len)
{
if(ch == str1[j]) //这里是==
value++;
j++;
}
cout << "the number of "<<ch<<" is:"<<value<<endl;
ch = str1[++i];
j=0;
value=0;
}
}

------解决方案--------------------
C/C++ code

#include<iostream>
using namespace std;
void main()
{
    char ch,str1[30]={0};
    int i = 0,j =0, len,value = 0;
    cout << "input the string:" << endl;
    cin.getline(str1,30);
    len = strlen(str1);
    ch = str1[i];
    while(ch != '\0')
    {
        while(j < len)
        {
        if(ch == str1[j])    //这里是==
            value++;
        j++;
        }
    cout << "the number of "<<ch<<" is:"<<value<<endl;
    ch = str1[++i];
    j=0;
    value=0;
    }
}