Okay, so I changed up my program.
My .csv file is like:
Bone,origin,deep/superficial,location, action
frontal, membranous connective tissue, deep, cranial, flexes arm
parietal, catilage, superficial, cranial, raises shoulder
and so forth.
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <cstdlib>
#include "Action.h"
#include "Action.cpp"
usingnamespace std;
void readCSV(istream &input, vector< vector<string> > &output)
{
string csvLine;
// read every line from the stream
while( getline(input, csvLine) )
{
istringstream csvStream(csvLine);
vector<string> csvColumn;
string csvElement;
// read every element from the line that is seperated by commas
// and put it into the vector or strings
while( getline(csvStream, csvElement, ',') )
{
csvColumn.push_back(csvElement);
}
output.push_back(csvColumn);
}
}
int main()
{
fstream file("bones.csv", ios::in);
if(!file.is_open())
{
std::cout << "File not found!\n";
return 1;
}
// typedef to save typing for the following object
csvVector csvData;
readCSV(file, csvData);
Queries queries(csvData);
system ("PAUSE");
return 0;
}
#include <iostream>
#include "Action.h"
usingnamespace std;
Queries::Queries(csvVector csvData)
{
int column_index;
cout << "What query do you want to enter?" <<endl
<<"(1) Action Query" << endl
<<"(2) Strengthening Query" << endl
<<"(3) Diagnostic Query" <<endl;
cin >> column_index;
}
If the user selects 1, they will be told to enter a action and it will output the bone.
If the user selects 2, they will be told to enter word "strengthen" with location and it will ouput bone.
If the user selects 3, they will be told to enter bone and it will output location and deep/superfifcial
Bone,origin,deep/superficial,location, action
#1 frontal, membranous connective tissue, deep, cranial, flexes arm
#2 parietal, catilage, superficial, cranial, raises shoulder
and so forth (with 38 of them)....
so bone are frontal and parietal
so origin are membranous connective tissue and deep (respectively)
so deep/ superficial are deep and superficial (respectively)
so location are cranial and cranial (respectively)
so action are flexes and parietal (respectively)