Hello I am wondering what the most efficient way would be to read a .csv file and store each comma separated item into its own array or variable. I can only use #include <iostream>
. I was thinking about maybe using .getLine(), but all i would know is the delimeter and value to store since there is no <fstream>
allowed. That being said does anyone know how I could go about this? Thanks in advance!
This is the layout of the file. The first line indicates the umber of rows to be read.
input file
3
2014,Computer Science,Utah,1568,44.9
2014,Marketing,Michigan,23745,983
215,Business Management, Idaho,256,674
code:
int year;
char* major = new char[40];//cant be longer than 40 characters
char* state = new char[40];
int enrolled;
int rate;
char p;//for cin.get characters possibly
cin>>rows
for(int i = 0; i <= rows; i++){
HMMMMM?
}