11-30-2012, 12:53 PM | #1 |
🥓<strong><span style="col
Resident Overseer
Join Date: Mar 2007
Location: Kingsport, TN
Posts: 7,648
|
C++ fstream and arrays
Okay, so I'm making this thread for two reasons:
1) I'm frustrated because I can't figure out what I'm doing 2) I want to learn how to do this correctly I was making a program for ssbmchamp's Powerball thread that would make things easier for comparing and figuring out payouts, etc. This is a general idea of my pseudo code: Code:
initialize input file and output files take in lines for each user, with their guesses guesses assigned to an array guess[i] guess[i] is compared to numbers[i through i+4], to see if there are any matches output and credit distribution is based on how many matches they have, etc. Lines are being read in as justin_ator [#,#,#,#,#][#][#] and I need a way to split the lines into the username, numbers, and useless info. I'm fine with the concept of doing Username [#,#,#,#,#][#][#] so that the username isn't an issue for reading, but I still don't know what I'm doing after that. I tried looking into tokens and delimiters, etc, but I just don't know how to assign the #'s to the array guess[i] without dealing with the [ and , and ]... I'm kind of confused. This was probably confusing. If I need to clarify something more, please do ask. I didn't post my code because I don't want you to write the program for me.. I want to learn how istringstream, tokens, iss, etc work if that's the best route to go. I tried looking into it and I was just kinda lost. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|