



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




// assume the string is s and s has been initialized list
// assume the string is s unsigned int i=0, j=0; while (j != s.size()) { if (s[j] != ’C’ && s[j] != ’c’) { S[i] = s[j]; // copy from location j to i ++i; ++j; // increment both } else ++j; // increment just j, thereby skipping the ’C’ or ’c’ } int old_size = s.size(); // Remember this because pop_back changes the size for (; i<old_size; ++i) s.pop_back(); // The previous two lines could also be accomplished with just // the following line (which is commented out). // s.erase(s.begin()+i, s.end()); // remove everything from i to the end
void rearrange(list
else { dbl.push_back(*itr); itr = dbl.erase(itr); } } }
void rearrange(list
b (( B Eee& &^E fg rz!!
b (( B Eee& &^Ea fg rz!!
bool is_alphabetical(string const& s) { char prev_letter = ’a’; for (unsigned int i=0; i<s.size(); ++i) { if (isalpha(s[i])) { char letter = tolower(s[i]); if (prev_letter > letter) return false; prev_letter = letter; } } return true; }
class Course { public: Course(const string& id, unsigned int max_stu) : course_id(id), max_students(max_stu) {}
private: string course_id; list
abe lincoln went to the white house
int count_vowels(const vector
int count_vowels(const vector
void copy_pos_neg(const list
Aardvark birthday anybody count car peppermint Ohio!! enough re-iterate baseball
bool vowels_in_order(string const& s) { char last_vowel = ’a’; for (unsigned int i=0; i<s.size(); ++i) { char c = tolower(s[i]); if (c == ’a’ || c == ’e’ || c == ’i’ || c == ’o’ || c == ’u’) { if (last_vowel > c) return false; last_vowel = c; } return true; }
int main() { string s; int all_count = 0, in_order = 0; while (cin >> s) { if (vowels_in_order(s)) in_order ++; all_count ++; } cout << in_order / (float) all_count < endl; return 0; }
void merge1(list
void merge2(list