I code this exercise in c++ with title: "count number of occurrences of a character in a string"
who can help me?
thanks very much
My code in c++:

#include "stdafx.h"
#include <iostream>
using namespace std;
unsigned count_check(char str[],char a)
{
         unsigned d=0,lenght=strlen(str);
         for(int i=0;i<lenght;i++)
           if(str[i]==a)
             d++;
         return d;
}
int main()
{
    char str[100],a;
    cout<<"input a string: ";
    gets(str);
    cout<<"input a character:: ";
    cin>>a;
    cout<<"the number of occurrences: "<<count_check(str,a)<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}

Several of us can help you, but you'll need to post what you've done so far. To quote DaniWeb's forum rules:

Do provide evidence of having done some work yourself if posting questions from school or work assignments.

As I said, we will provide assistance. We won't hand you a solution to a homework problem for no effort on your part, however. Show us your work, and we'll help you fix it, but the community's ethical guidelines won't allow us to do more than that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.