#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
void start(char x[]); //function prototype
void fillit(char x[], int SIZE, int&, int&, int&, int&, int&);
const int SIZE = 80;
int main() {
int num_a=0, num_e=0, num_i=0, num_o=0, num_u=0;
char x[SIZE];
start(x);
fillit(x, SIZE);
cout << "A occured " << num_a << " times" << endl;
cout << "E occured " << num_e << " times" << endl;
cout << "I occured " << num_i << " times" << endl;
cout << "O occured " << num_o << " times" << endl;
cout << "U occured " << num_u << " times" << endl;
}
void start(char x[SIZE]) {
cout << "Input a sentence up to " << SIZE << " characters long, and I will te\
ll you how many times each vowel occurs in it." << endl;
cin.getline(x, SIZE);
}
void fillit(char x[SIZE] int &num_a, int &num_e, int &num_i, int &num_o, int &n\
um_u) {
int index = 0;
int length = strlen(x);
while (index < length){
if(x[index] == 'a'){
num_a++;
}
if (x[index] == 'e'){
num_e++;
}
if (x[index] == 'i'){
num_i++;
}
if (x[index] == 'o'){
num_o++;
}
if (x[index] == 'u'){
num_u++;
}
index++;
}
}
now i'm really frustrated.
Ive been trying to finish an assignment all day and i havnt finished a single thing. I don't understand functions for the life of me, i get almost everything else but functions. WHY oh WHY won't this compile?! i keep getting errors no matter WHAT i do to my prototype OR the function itself. very disheartened, very frustrated

New Topic/Question
Reply




MultiQuote




|