Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <cstdlib>
- #include <fstream>
- #include <ios>
- #include <iomanip>
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <sstream>
- using namespace std;
- /*** These are the Variables I use for a weapon, they corrospond according to number in list: Wooden Shortsword is first in the
- *** sSwordName Array, so it's lvl requirment would be 1 since it is first.
- *** Idealy this is the way I want things to work... Unless anyone has a better idea, I am open to hear them. I can always
- *** learn more, especially from others. ***/
- char sSwordName[10][25] = {"Wooden Shortsword", "Bronze Shortsword", "Iron Shortsword", "Steel Shortsword", "Titanium Shortsword"};
- int sSwordLvlR[10] = {1, 3, 5, 6, 10};
- int sSwordV[10] = {5, 10, 18, 25, 50};
- int sSwordP[10] = {10, 20, 40, 60, 100};
- int sSwordMinAtk[10] = {0, 0, 0, 0, 0};
- int sSwordMaxAtk[10] = {4, 6, 10, 14, 20};
- int sSwordAtkRate[10] = {0, 2, 3, 4, 6};
- int sSwordStrR[10] = {1, 6, 11, 16, 22};
- int sSwordAtkR[10] = {1, 6, 11, 16, 22};
- int sSwordIntR[10] = {1, 3, 5, 8, 12};
- /*** Now this is as close as I have been able to get to get this to work, sadly it is still off base...
- *** I need it to take for example: Row 1 > Exclude Column 1 > Input Data > Assign to sSwordName[5][25] Array.
- *** My issue is, finding a way to loop it where it takes all the cells in Row 1, ignores the first cell
- *** (I think making it do like "\n" for it would work? Not sure) and then loop through the rest of the rows
- *** repeating the same algorithm, Ignoring the first cell, inputting, assinging them to the variable arrays?
- *** It is much much easier to edit item stats and add new items in Excel, than having to do it via code as you
- *** may imagine..
- *** I am pretty sure my code is far from what would be best, I bet it needs to be re-written a new way as well..
- *** I would greatly appreciate Anyone who can help me accomplish this task.. It would really make my life
- *** A lot easier, as well as make my project code considerbly shorter.. */
- int main()
- {
- int w;
- double z;
- string word;
- string y;
- ifstream infile("Example.csv");
- while (getline( infile, word ))
- {
- if (word.empty()) continue;
- istringstream ss( word );
- {
- string val;
- getline( ss, val );
- stringstream( val ) >> w;
- cout<<" "<<w;
- getline( ss, val );
- stringstream( val ) >> z;
- cout<<z<<endl;
- }
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement