1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include < iostream>
#include <cstring>
using namespace std;
int reverseDigits(char num[], char revNum[], int,int,char let);
int main()
{
char let;
char letters[10] = {' '};
char reverseletters[10] = {' '};
//int multiplier = 1;
bool isNegative = false;
cout << "Enter a string: ";
cin >> letters;
cout << endl;
int len = strlen(letters);
int ind = 0;
reverseDigits(letters, reverseletters, len, ind,let);
cout << letters << " after reversal = "
<< reverseletters << endl;
// display vowel count
cout << "There were "<< let << "vowels in the word.";
system("pause");
return 0;
}
int reverseDigits(char num[], char revNum[],int len, int ind,char let)
{
if (len == 0)
return let;
else
{
// if check for vowel
if (let == 'a' || let == 'e' || let == 'i' || let == 'o' || 'u')
len -= 1;
revNum[ind] = num[len];
ind += 1;
reverseDigits(num, revNum, len, ind,let);
}
}
| |