Erase letters via substring..?

Hi,

Like many who post here, I am new and quite crappy with c++. I have to perform a ratio for my homework. Essentially, if someone plugs in "4 shoes" and "8 Laces," my final ratio/output should say "shoe-to-lace ratio .5" i.e., "shoes" has to become "shoe," no s. Here is my current code, but I don't know crap about substrings:

#include<iostream>
#include<string>

using namespace std;

int main() {



double first_category;
double second_category;
string category_1;
string category_2;

/*345678901234567890123456789012345678901234567890*/


cout << "How many in the first category? ";
cin >> first_category >> category_1;
cout << "How many in the second category? ";
cin >> second_category >> category_2;
cout << "\n ";

cout << " " << category_1 << " " << first_category << endl;
cout << " " << category_2 << " " << second_category << endl;
cout << category_1 << "-to-" << category_2 << " ratio " << first_category / second_category << endl;
cout << category_2 << "-to-" << category_1 << " ratio " << second_category / first_category;
cout << "\n\n";




system("pause");

return 0;

}
> if someone plugs in "4 shoes" and "8 Laces,"
> my final ratio/output should say "shoe-to-lace ratio .5" i.e., "shoes" has to become "shoe," no s.

What should your output say if someone plugs in "26 alumni" and "5 seminaries"?
Topic archived. No new replies allowed.