1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
/**
Name: William Lee
Compiler: GNU GCC Compiler
Ass#4
*/
#include <iostream>
#include <cstring>
#include <fstream>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <string>
using namespace std;
void readthefile(const int, ifstream&, char*[], int);
void selectionSort(const int, string, ifstream&);
int main(){
const int unsorted_words = 27905;
ifstream infile;
int i = 0;
char **array2 = new char*[unsorted_words];
infile.open("unsorted_words.txt");
if (!infile){
cout << "File not found" << endl;
}
else{
// readthefile(unsorted_words, infile, array2, i);
while(infile.getline(array2[i], 100000000)){
cout << array2[i] << endl;
i++;
}
delete [] *array2;
infile.close();
}
return 0;
}
//void readthefile(const int unsorted_words, ifstream &infile, char *areee2[], int i){
// while(infile.getline(areee2[i], unsorted_words)){
// cout << areee2[i] << endl;
// i++;
// }
//}
//void selectionSort(const int size_of_array, string areee[], ifstream& file)
//{
// int minIndex;
// for (int i = 0; i < size_of_array - 1; i++)
// {
// minIndex = i;
// for (int j = i+1; j < size_of_array; j++)
// {
// if (areee[j] < areee[minIndex])
// {
// minIndex = j;
// }
// }
// if(minIndex != i) {
// swap(areee[i],areee[minIndex]);
// }
// }
//}
//
// char array3[] = "HAVE A NICE DAY";
// printStringBytes(array3,strlen(array3)+1);
// ptr2char = strtok(array3,"ABC");
// cout << ptr2char << endl;
// printStringBytes(array3,sizeof(array3));
// ptr2char = strtok(NULL,"ABC");
// cout << ptr2char << endl;
// printStringBytes(array3,sizeof(array3));
// while (ptr2char != NULL)
// {
// ptr2char = strtok(NULL,"ABC");
// cout << ptr2char << endl;
// printStringBytes(array3,sizeof(array3));
// }
//}
//
|