string word = "abcde";
  int count = 0;
  for(int i = 0; i < word.length(); i++){
    for(int j = 1; j < word.length(); j++){
      if( =={

i am trying to write a program that when i am given a string i can count letter pairs in the string so for example: cat returns 0 and doggy returns 1. this i what i have written now and i tried cout the loops and such but im still very lost in what i am doing wrong. any help would be very helpful

the count should equal 0 but instead it counts to 4...

Be a part of the DaniWeb community

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