Setup getting filename and inputting list
This commit is contained in:
+5
-3
@@ -1,7 +1,9 @@
|
||||
#include <iostream>
|
||||
#include "sorts.h"
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::cout << "hello world\n";
|
||||
Sorter newSort;
|
||||
newSort.SetFileName(argv[1]);
|
||||
newSort.SetWordList();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "sorts.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
void Sorter::SetFileName(std::string newName)
|
||||
{
|
||||
this->filename = newName;
|
||||
}
|
||||
|
||||
std::string Sorter::GetFileName(void)
|
||||
{
|
||||
return this->filename;
|
||||
}
|
||||
|
||||
void Sorter::SetWordList(void)
|
||||
{
|
||||
std::string bufferStr;
|
||||
std::ifstream file(this->filename);
|
||||
if (!file.is_open())
|
||||
{
|
||||
std::cout << "Failed opening file\n";
|
||||
exit(1);
|
||||
}
|
||||
while (getline(file, bufferStr))
|
||||
wordList.push_back(bufferStr);
|
||||
return;
|
||||
}
|
||||
|
||||
void Sorter::InsertionSort(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void Sorter::MergeSort(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void Sorter::HeapSort(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
Reference in New Issue
Block a user