#include <iomanip>
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main ()
int i,count(0),n;

char strg1[50],strg2[2];
char *ptr1(strg1), *ptr2(strg2);

cout << "Please input the string" << endl;
cin >> strg1;

cout << "Please input the character" << endl;
cin>> strg2;

while ((ptr1=strstr(ptr1,ptr2)) != NULL)
cout << "Count: " << count << endl;
system ("pause");
return 0;

I did dot about assignment which counts the repeated letters of our choosing but how do i make it count the all the repeated letters?

My assignment is this:

Write a function that receives a pointer to a character string and return the number of repeated characters the occur in the string. For example, the string "mississippi" has three repeated characters. Do not count repeated blanks in the string. If a character occurs more than two times, it should still count as one repeated character. Assume that the function has the prototype statement
int repeat(char*ptr)

cycle through each lettter in the alphabet, a through z, and check each letter if it repeats.

remember that ascii code character A is decimal 65 and Z is decimal 90. lowercase a is decimal 97 and lowercase z is 122. you can subtract 32 from any lowercase letter to get its uppercase version.

I would cycle through each letter in the string that was inputed an see if it was repeated then you will be down to at most a number of checks equal to the size of the string.

This question has already been answered. Start a new discussion instead.