Hello,
I am new to this C++ stuff and I am in need of assistance with this code for counting vowels. I missed a few days of class and am some what lost. I keep getting the error codes: C2228 saying it must have class/struct/union and C2109 requires array or pointer type. I have highlighted said error areas in red. I am unsure how to resolve this and any help would be great.

//	===================
	#include "stdafx.h"
	#include <iostream>
	#include <iomanip>
//	===================

//	===================
//	function prototypes
//	===================
	int vowel(int);
//	===================

//	==========
//	Name Space
//	===================
	using namespace std;
//	====================
	
//	===========
	int main( )
	{
//	=====================
//	variable declarations
//	==================
	char enterLetter;
	char userResponse;
	char userInput;
	int    vowelCounter;
//	============

//	============
//	input letter
//	===================
	while(enterLetter){
	cout << "Please enter a string of characters " << endl;
	cout << "and I will tell you how many vowels you entered. "  << endl;
	cin >> userInput;
	cout << endl;
//	=================

//	=======
//	analyze 
//	===========================
	vowelCounter = vowel(userInput);
	if(vowelCounter > 0) 
	cout << "You have entered " << vowelCounter
		<< " vowels." << endl;
	else 
	cout << "You did not enter any vowels in this   string of characters." << endl;
//	=====================


	cout << "Go again? (y/n)?" << endl;
	cin >> userResponse;
	cout << endl;
	
	if(userResponse == 'n')
	enterLetter = false;
		} 

	return 0;
	}//function main


//	================
//	function vowelCount
//	==========================
	int vowel (char userInput)
	{
	 int vowelcounter = 0, i;
	 for(i=0; i < userInput.length(); i++)
	   switch (userInput[i])
	  {
		case 'a':
	    case 'A':
	    case 'e':
	    case 'E':
		case 'i':
	    case 'I':
	    case 'o':
		case 'O':
		case 'u':
		case 'U':
	      vowelcounter++;	
		  break;
	  }
	  return vowelcounter;
	}
//	function vowelCount

Well you treathing a char as a string or a charr array.
the .lenght() function only works on strings.
And you are only passing a char to the function, it should be a pointer to a char array.

Be a part of the DaniWeb community

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