Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- string convert_lower(string word);
- string sort(string friends[]);
- int main()
- {
- string friends[] = {"C++","CS:GO","Cancer retards","White people","Trump","Cyka","Ruski","men?","Shrimplord"};
- int n = sizeof(friends)/sizeof(friends[0]);
- for ( int i = 0; i < n; i++) {
- friends[i] = convert_lower(friends[i]);
- }
- for ( int i = 0; i < n; i++) {
- for ( int j = 0; j < n; j++) {
- if (friends[i].at(0) < friends[j].at(0)) {
- string tmp = friends[i];
- friends[i] = friends[j];
- friends[j] = tmp;
- }
- }
- }
- for ( int i = 0; i < 9; i++) {
- cout << friends[i] << endl;
- }
- return 0;
- ofstream output;
- output.open("C:\Users\logan\meh.txt", fstream::out);
- for (int i =0;i<n;i++)
- {
- output << friends[i] << endl;
- }
- output.close();
- }
- string sort(string* friends)
- {
- //Pointers are lyfe
- return *friends;
- }
- string convert_lower(string word)
- {
- string final;
- for (int i=0;i < word.size();i++)
- {
- final += tolower(word[i]);
- }
- return final;
- }
Advertisement
Add Comment
Please, Sign In to add comment