// hw05prob1.cpp
// Assignment 5 - practice problem #1
#include <iostream>
int main()
{
const int LENGTH = 15;
// Input a word:
cout << "Enter a word (at most "
<< LENGTH << " characters):>";
char word[LENGTH+1];
cin >> word;
// Determine length of actual word:
int length = 0;
while ( word[length] != '\0' )
length++;
// Output intro:
cout << endl << "\'" << word[length-1]
<< "\' appeared at these positions:"
<< endl << endl;
for (int i = 0; i < length; i++)
{
if ( ( word[i] == word[length-1] )
|| ( word[i] >= 'A' && word[i] <= 'Z'
&& word[i] == (word[length-1] + 'a' - 'A') )
|| ( word[i] >= 'a' && word[i] <= 'z'
&& word[i] == (word[length-1] + 'A' - 'a') ) )
cout << " " << (i + 1) << endl;
} // for i
return 0;
} // main