Go Back   Flash Flash Revolution > General Discussion > Technology
Register FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11-30-2012, 12:53 PM   #1
justin_ator
🥓<strong><span style="col
Resident Overseer
FFR Veteran
 
justin_ator's Avatar
 
Join Date: Mar 2007
Location: Kingsport, TN
Posts: 7,648
Default 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.
My issue is as follows:
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.
justin_ator is offline   Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 11:24 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution