Struggling with functions

Hello
I'm struggling with a function. My goal is to rite a program that reads a string and outputs the number of times each lowercase vowel appears in it. The program must contain a function with one of its parameters as a string variable and five other integer reference parameters with each one representing the number a particular vowel appears in the string. The program should request a string input from the user then display the results of the function.

Function Definition : void vowelCount(string wordInput, int& aCount, int& eCount, int& iCount, int& oCount, int& uCount) ;


Here is what I have so far. What I'm struggling with is how to plant this code into a function. The code I have written is how I want the the function to operate, but I don't know how to utilize it with the function syntax that my instructor has given me
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
#include<iostream>
#include<string>
using namespace std;


int main(){

	int aCount = 0;
	int eCount = 0;
	int iCount = 0;
	int oCount = 0;
	int uCount = 0;
	string wordInput;
	cout << "Enter a string for vowel analyzing: " << endl;
	
	getline(cin, wordInput);

	for (int i = 0; i < wordInput.length(); i++){
		if ((wordInput[i] == ('a')))
			aCount = aCount + 1;
	}
	for (int i = 0; i < wordInput.length(); i++){
		if ((wordInput[i] == ('e')))
			eCount = eCount + 1;
	}
	for (int i = 0; i < wordInput.length(); i++){
		if ((wordInput[i] == ('i')))
			iCount = iCount + 1;
	}
	for (int i = 0; i < wordInput.length(); i++){
		if ((wordInput[i] == ('o')))
			oCount = oCount + 1;
	}
	for (int i = 0; i < wordInput.length(); i++){
		if ((wordInput[i] == ('u')))
			uCount = uCount + 1;
	}
	cout <<"Number of A's: "<< aCount<<endl;
	cout << "Number of E's: " << eCount << endl;
	cout << "Number of I's: " << iCount << endl;
	cout << "Number of O's: " << oCount << endl;
	cout << "Number of U's: " << uCount << endl;
	
	
	system("pause");
	return 0;


}
Topic archived. No new replies allowed.