.csv file

Pages: 12
Weird. Try anyways to run the exe directly.
Okay, so I got my program to read and print the .csv file.
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
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
using namespace std;

void readCSV(std::istream &input, std::vector< std::vector<std::string> > &output)
{
        std::string csvLine;
        // read every line from the stream
        while( std::getline(input, csvLine) )
        {
                std::istringstream csvStream(csvLine);
                std::vector<std::string> csvColumn;
                std::string csvElement;
                // read every element from the line that is seperated by commas
                // and put it into the vector or strings
                while( std::getline(csvStream, csvElement, ',') )
                {
                        csvColumn.push_back(csvElement);
                }
                output.push_back(csvColumn);
        }
}

int main()
{
        std::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
        typedef std::vector< std::vector<std::string> > csvVector;
        csvVector csvData;

        readCSV(file, csvData);
        // print out read data to prove reading worked
        for(csvVector::iterator i = csvData.begin(); i != csvData.end(); ++i)
        {
                for(std::vector<std::string>::iterator j = i->begin(); j != i->end(); ++j)
                {
                        std::cout << *j << ", ";
                }
                std::cout << "\n";
        }

system ("PAUSE");
return 0;


Can someone please help me create a class in which the user enters the action, and it will return which bone is involved. Also, the action are in 3rd person singular, but it must understand it in the imperative form, for example flexes verses flex.
Last edited on
Please someone help me. I would greatly appreciate it :]
I need to create one in which the user enters the action, and it will return which bone is involved.
I need to create one in which user enters body part (location), and it will return which bones are involved.
I need to create one in which user enters muscle, and it will return the
body part (location) along with deep or superficial.
Can I do this in one class or are three classes needed?
Topic archived. No new replies allowed.
Pages: 12