How do I get Rid of this error main.cpp:43:19: error: no viable overloaded '=' novowels[100] = remove(name[100]);

139 Views Asked by At

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;
   }
}
1

There are 1 best solutions below

0
On

= 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.