0

Your program must contain a function to remove all

the vowels and a function to determine whether a character is a vowel. I keep recieveing this error

main.cpp:43:19: error: no viable overloaded '='     novowels[100] = remove(name[100]); * 
 * 
 * 
 * 
 * 
 */
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;
void remove(string name);
bool check(string letter);

int main()

{
   string novowels[100];
   string name[100];
   cout << "Please insert a string: ";
   getline(cin, name[100]);
   novowels[100] = remove(name[100]);  //ERROR IS HERE!!!
   cout << "\n This is your string without vowels homie:\n " << novowels;

   return 0;
}

string remove(string name[100]) {
   int j = 0;
   bool trueorfalse;
   string novowels[100];
   for (int i = 0; i < 99; i++) {
      trueorfalse = check(name[i]);
      if (trueorfalse == false) {
         novowels[j] = name[i];
         j++;
      } else if (trueorfalse == true) {

      } else {
         break;
      }

   }
   return novowels[100];
}

bool check(string letter) {

   if (letter == "a" || letter == "e" || letter == "i" || letter == "o" ||     letter == "u" || letter == "A" || letter == "E" || letter == "I" || letter == "O" || letter == "U") {
      return true;
   } else {
      return false;
   }
}
Community
  • 1
  • 1
  • 4
    Trying to access the 101st element of an array with 100 elements will not end well. I don't think you meant for those to be arrays at all. – chris Apr 26 '15 at 23:40
  • I think you should replace all of your "string" to "char". – Berke Cagkan Toptas Apr 26 '15 at 23:46
  • 2
    You have declared two different overloads of `remove`: `void remove(string)` and `string remove(string*)`. You have only defined the latter, but you are calling the former. The version you are actually calling doesn't return any value, and thus cannot appear on the right hand side of an assignment. – Igor Tandetnik Apr 26 '15 at 23:47

1 Answers1

0

= operator can't assign a void value to integer or string or ...

because your remove don't return any things you can't use this function at right side of assignment.

Mohsen Bahaloo
  • 257
  • 2
  • 2