Hi everyone
I need to be able to read each character from a text file and store them in an array
here is the text file:
*********************
Ace of Spades
10 of Spades
3 of Clubs
King of Spades
5 of Spades
*********************
Queen of Diamonds
King of Hearts
Queen of Hearts
Queen of Clubs
Queen of Spades
*********************
2 of Clubs
2 of Hearts
Ace of Clubs
2 of Diamonds
Ace of Diamonds
*********************
2 of Hearts
3 of Hearts
4 of Hearts
5 of Hearts
6 of Hearts
for instance i need to be able to store the integers in an array.. and then i need to store the string hearts ,clubs in another string array.and i need to ignore the spaces, the'*' so far i have not been able to do it.. i seriously need help. i've been trying different thongs like getline(), indata.getline, getline(indata, str)
none have been working
here's what i did..i managed to make the program read the file
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
int main()
{
string str;
ifstream inData;
string filename;
cout << "Enter the name of the file containing the hands: " << flush;
cin >> filename;
inData.open(filename.c_str( ));
but now i don't know how to continue. i am really bad at programming.:( plz someone help me... thanks