I am tryin gto make a program that allows the user to enter a string as a character array and a letter to delete from the array. I am having a very hard time deleting the letter from the array. The word can not have a space where the letter used to be. So if the user enters "hello world" and the letter 'l'. It should print "heo word". Can someone please point me in the right direction here? Thanks
Code:
#include<iostream>
using namespace std;
int main()
{
void remove(char[], char);
char letter ;
const int MAX = 55;
char cstring[MAX];
cout << "Enter sentence and a letter will be removed\n";
cin.getline(cstring, MAX);
cout << "Enter letter to be removed";
letter = cin.get();
remove(cstring, letter);
cout << cstring << endl;
cin.ignore();
return 0;
}
void remove(char cstring[], char letter)
{
char temp;
for(int i = 0; cstring[i] != '\0'; i++)
{
if(cstring[i] == letter) cstring[i] =
}
}