rendered paste body/********************************************************
/Filename MP5.cpp
/Name: Mark Ratering
/CPS 171, Mar 31
/
/
*********************************************************/
#include <iostream>
#include <string>
#include<fstream>
using namespace std;
//Lets overload some functions!
void tr(string& name, char target);
void tr(string& name, char target, char bullet);
int main()
{
string name (" Steve, Jones E.");
enum marital_status {
SINGLE,
MARRIED,
WIDOWED,
DIVORCED
};
//squish all spaces out
tr(name, ' ');
cout << name << endl;
}
void tr(string& name, char target){
int index=0;
string::size_type loc;
loc=name.find(target, index);
while( loc != string::npos ) {
string next_char;
do {
//Reset the index to start looking after the current find.
index=loc++;
next_char=name.substr(index, 1);
if (next_char==" ")
name.erase(index);
} while ( next_char == " " );
}
}