Clinton Portis 211 Practically a Posting Shark

have fun with this game o' keno! post here with your highest winnings

Clinton Portis 211 Practically a Posting Shark

in my opinion, you should write functions that evaluate everything from royal flush to high card:

//function prototypes
bool is_royal_fush(hand[7]);
bool is_straight_flush(hand[7]);
bool is_4kind(hand[7]);
bool is_full_house(hand[7]);
bool is_flush(hand[7]);
bool is_straight(hand[7]);
bool is_3kind(hand[7]);
bool is_2pair(hand[7]);
bool is_pair(hand[7);
int get_high_card(hand[7]);

Some hands might qualify for several winning scenarios, so it is important to test from royal flush down to high card and break at the first true test in order to get the highest value of the hand.

Clinton Portis 211 Practically a Posting Shark

for example, if the 'id' criteria is a single character, you will be passing in two erroneous arguments to the substr() function:

//if the size of s[i] is 1 char
tmp[i].ID=s[i].substr(1, s[i].size()-2);

the first argument will resolve to a starting index equal to 1, which is already out of bounds of the s[0] array. additionally, you will be subracting 2 from the array size, which in this case is 1; therefore, passing in a negative value to substr() which will result in an out of bounds error being thrown.

there are easy ways to obtain the implementation ye' desire, try it on your own and see if you can figure it out. come back with what you come up with and we can help you out.

Clinton Portis 211 Practically a Posting Shark

hmm

Clinton Portis 211 Practically a Posting Shark

I'm just briefly looking at your code, but is there any case where the size of s[i] would be less than 2? if so, you'd then be subtracting 2 and passing a negative value to substr():

tmp[i].ID=s[i].substr(1, s[i].size()-2);

furthermore, your starting position is '1', so is there any case where the size of s[i] would be less than 1? (For example, trying to start at element [1] on a string of consisting of a single character, in which case you would start and end at element [0])

Clinton Portis 211 Practically a Posting Shark
//Dynamic 2D memory allocation

float* matrix = NULL;

float** userMatrix = new matrix*[10];

for (int i=0; i<10; i++)
{
     *userMatrix[i] = new matrix;
}
Clinton Portis 211 Practically a Posting Shark

when it took me 6 months to figure out how to add basic resources to a win32 project.... and going through 5 compilers just to change window background color, i knew this **** was just to messed up. i'm glad i stopped at just c++ or else i would be spending the rest of my life as an abusive and angry alchoholic.

Clinton Portis 211 Practically a Posting Shark

win_messaage() is a funtion call to a function that you write that will probably display some sort of message to the winning player that they actually won.

Clinton Portis 211 Practically a Posting Shark

Quoted Text Herehello i am creating a tictictoe game , however i cannot get the program to check if the player has won or not . and produce a you have won message

void win_check(char Map[10])
{
     //Row checks
     for(int i=0; i<10; i+=3)
     {
          if(Map[i] == Map[i+1] && Map[i+1] == Map[i+2])
          {
               win_message();
               return;
          }
     }

     //Column checks
     for(int i=0; i<3; i++)
     {
          if(Map[i] == Map[i+3] && Map[i+3] == Map[i+6])
          {
               win_message();
               return;

     }

     //Diag checks
     if((Map[0] == Map[4] && Map[4] == Map[8]) || (Map[2] == Map[4] && Map[4] == Map[6]))
     {
          win_message();
     }
}
Clinton Portis 211 Practically a Posting Shark
int get_tiles(int& length, int& width){return length * width}
Clinton Portis 211 Practically a Posting Shark

My magic 8 ball says, "ask again later."

Clinton Portis 211 Practically a Posting Shark

One problem may be that you never initialized any of your variables.

//These could literally be any value.
int n,x,i,j;

Here you create a variable 'j', and make a whole bunch of loop conditions that are based on 'j'... 'j' could be anything......

for([B]j[/B]=(2*[B]j[/B]-1);[B]j[/B]>0;[B]j[/B]--)
Clinton Portis 211 Practically a Posting Shark

if the EOF flag is set and it's giving you problems with seekg(), try clear()'ing the object and see if that works for ye'.

Clinton Portis 211 Practically a Posting Shark

i've actually looked up youtube videos to teach myself this somewhat complex topic... never actually studies flow systems. i got the basic concept and can do some simple examples.

i am down with your code, but i am not down with flow systems. if we put our heads together we might be able to come up with something. one thing that might help me out (if you are interested in doing so) would be to comment every line of code so I can see what your though process is.

Clinton Portis 211 Practically a Posting Shark

int types do not support floating point decimal. try using double types, and if you desire a set precision, you can go even further and use float's.

with your calculator application, it is possible to prompt the user for a desired precision, in which case you would use float types.

http://www.cplusplus.com/reference/iostream/manipulators/setprecision/

Clinton Portis 211 Practically a Posting Shark

so can only search for the IDS_STRING part. How can I achieve that?

try a little somethin' like this:

vector<string> text_file;

//load the vector........

//find substrings in your vector:
for(int i=0, size=text_file.size(); i<size; i++)
{
     if(text_file[i].substr("IDS_STRING") != string::npos)
     { 
          //found
     }
     else
     {
          //not found
     }
}

I'm basically trying to go through the file and see if each IDS_STRING number exists, so from 1 to 4000, and if it doesn't I want to write a new line in the file with the IDS_STRING number.

This isn't too terribly difficult; however, the data structure ye' have chosen (vector) is a poor container when it comes to insertion that does not occur at the very end. A better choice for your application would be the <list> class... which is very similar to <vector> but offers an efficient insert() function (<list> offers the efficiency of a double-linked list data structure, unlike the array type of <vector>) So, what you would want to do is to populate your list and sort it using the sort() function from <algorithm>. You would want to (and have to) use the overloaded version of sort() that allows you to pass in your own custom compare function. This will allow you the flexibility to parse the list elements and perform a strict < less than comparison between elements. Sort the list, perform insertions as desired, open a file to write to. (if file already exists, open using the ios::trunc flag to overwrite the …

Clinton Portis 211 Practically a Posting Shark

Fun game for the raging compulsive alchoholic gambler, such as myself.

Although the game may vary among casinos, the basic premise is the user picks 10 numbers out of 80. The computer will randomly draw 20 numbers out of 80. If you matched with any of the computer picks, you win mad amounts of cash.

The game is made using the simplest of c++ constructs; mostly 1 dimensional arrays and for loops.

Here is a mind-blowing statistic I learned whilst doing a little homework on the game of keno:

The probability of a player hitting all 20 numbers on a 20 spot ticket is approximately 1 in 3.5 quintillion (1 in 3,535,316,142,212,180,000 to be exact). If every person now alive played one keno game every single second of their lives, there would be about one solid 20 jackpot-winning ticket to date. If all these possible keno tickets were laid end to end, they would span the Milky Way galaxy—and only one of them would be a winner. To this day, there are no reports of a keno player lucky enough to match all 20 numbers. (from wikipedia.org)

Here be the code:

#include <iostream>
#include <algorithm>
#include <ctime>
#include <windows.h>

using namespace std;

struct coord
{
    int X;
    int Y;
    int number;
    bool selected;
    coord(){selected = false;}
};

class keno
{
    public:

    //class default constructor
    keno();
    //game functions
    void display_board();
    void display_numbers();
    void get_picks();
    void computer_draw();
    void calc_winnings();
    void reset();
    //console enviornment
    void set_console_size(int x, …
Clinton Portis 211 Practically a Posting Shark

not only do you want numbers 10 thru 30, you want unique (non-repetitive) numbers. so this is how ye' can go aboot' it:

int random = 0;
int numbers[69];
bool is_included(int numbers[], int);

srand(time(NULL));

for(int i=0; i<=amount_requested; i++)
{
     //pick a random number in the range ye' desire
     random = rand()%21+10;

     //if it's not already in the array...
     if(!is_included(numbers, random))
     {
          //add it
          numbers[i] = random;
     }
     else //try again
     {
          i--;
     }
}

so, you have a little algorithm for ye' free of charge. it will load an array of with numbers from 10 to 30 with no repetition. of course, you will have to write the function definition for is_included(), but it's not that hard. if you struggle with that function, i will give it to you, but only if you first show an attempt of your own.

Clinton Portis 211 Practically a Posting Shark
#include <iostream>

int main()
{
     std::cout << "Merry Christmas Everyone!";
     return 0;
}
Clinton Portis 211 Practically a Posting Shark

please change the name of the var in line #4 of the random_question() function, as it has already been previously reserved in the enum{} block.

Clinton Portis 211 Practically a Posting Shark

There are still a lot of unknowns with your program, such as the nature of your Q/A as well as the format of your text files.

somehow I need to have the program check whether the answers are correct or not and if they're incorrect, then output the error message. Thanks in advance.

Here is one approach I would take with this assignment... You can make your text files with the question on one line, and acceptable answers on the following line:

How many protons in Uranium
92
What control surface controls the 'pitch' of an airplane
elevator, elevator-trim, trim tab
Where do horses go when they are sick
the horsepital, the glue factory
How many beers are in a 6 pack
6, half dozen, half-dozen, not enough

Since you now have a predictable format of the text file, we can make safe assumptions that the first line read will be the question and line following with be a list of acceptable answers. we can now load the text file accordingly into the data structure of ye' choice.

string text_file[69][2]
enum{question, answer};
int counter = 0;

while(infile)
{
     getline(infile, text_file[counter][question]);
     getline(infile, text_file[counter][answer]);
     counter++
}

Now we can pick questions at random..

void random_question(string text_file[69][2])
{
     int rand = rand()%(counter+1);
     string answer;

     //display question
     cout << text_file[rand][question] << '?' << endl;

     //prompt for answer
     cout << "Enter ye' answer: ";

     //get answer
     cin >> answer;

     //check answer
     //(simply calling the string class member function find() 
     //and making …
Clinton Portis 211 Practically a Posting Shark

your assignment is very easy. i could write it in less than 5 minutes.

please excerpt some sort of effort...

peace out yo.

Clinton Portis 211 Practically a Posting Shark

I can give ye' some help with solving a quadratic equation in c++, but I have no help for ye' when it comes to MFC. I could even help you solve the equation symbolically as opposed to a close decimal approximation.

Clinton Portis 211 Practically a Posting Shark

it's pretty easy to do.. just compare the number you with every occupied element in the array. if it is not in the array, add to array. else, try again.

Clinton Portis 211 Practically a Posting Shark

it's not a full working program.. it's a code snippet. but the basic algorithm should be enough to jog some of them marbles rollin' around in your noggin' and at some point you'll say, "ah, I see.. lemme try this approach.."

As opposed to where you are right now, which is, "GIMME TEH WORKING CODEZ!!!@!@###$!!!!"

Clinton Portis 211 Practically a Posting Shark

I think you'd have to first check to see if there are any possible moves your king can make... and then if the attacking piece is not a knight, you will probably have to check every other piece on the board to see if it can move anywhere inside the line of the attacking piece and the king. lastly, every piece should be tested to see if it can actually kill the attacking piece.

if the king cannot make a legal move, and the attacking piece is a knight, then the only possible scenario is a checkmate (unless the knight itself can be taken.) No block can occur.

When all three conditions occur; no legal move for king, no block can occur, and the attacking piece cannot be taken, only then can you conclude checkmate.

VernonDozier commented: Good suggestions. +15
Clinton Portis 211 Practically a Posting Shark

Here is a c++ solution:

#include<fstream>
#include<iostream>
#include<string>
#include<vector>
using namespace std;

bool is_label(string);
bool is_operand(string);

struct line_obj
{
     string label;
     string opcode;
     string operand;
}temp;

vector<line_obj> text_file;
string word;

ifstream infile("inputfile2.txt");

if(infile.is_open())
{
     cout << "\aFile failed to open.";
     cout << "\nFile may have been moved, renamed, or deleted.";
     cout << "\nPress [ENTER] to continue...";
     cin.get();
}

while(infile)
{
     infile >> word;
     if(is_label(word))
     {
          temp.label = word;
     }
     else
     {
          temp.label.clear();
     }
     infile >> word;
     if(is_operand(word))
     {
          temp.operand = word;
     }
     else 
     {
          temp.operand.clear();
     }
     infile >> temp.operand;

     text_file.push_back(temp);
}

infile.close();

//Display
for(int i=0, size=text_file.size(); i<size; i++)
{
     cout << text_file[i].label << ' ' << text_file[i].opcode << ' ' << text_file[i].operand << endl;
}
Clinton Portis 211 Practically a Posting Shark
string s("augcuuaucaca");
string temp;
int size = s.size();
int pos = 0;
vector<string> list;

do{
     try
     {
          temp = s.substr(pos, 3);
          list.push_back(temp);
          pos += 3;
     }
     catch(out_of_range)
     {
          break;
     }
}while(pos != size);
Clinton Portis 211 Practically a Posting Shark

you seem to be doing fine. do you need any help on any particular portion of your assignment..?

Clinton Portis 211 Practically a Posting Shark

in order to avoid repetition, you will have to push skills you have selected into an array, and compare the contents against future randomly generated skills. if skill has been used, try again.

Clinton Portis 211 Practically a Posting Shark

system("cls") is cheap and easy. just like my women.

Nick Evan commented: Hehe :) +17
Clinton Portis 211 Practically a Posting Shark

Full working program:

#include <iostream>
#include <ctime>
#include <windows.h>

using namespace std;

void gotoxy(int, int);
void set_console_size();

int main()
{
     enum{up, right, down, left};
     char stickman[3][4];
     int direction = 0;
     int x = 40,
         y = 20;

     srand(time(NULL));
     set_console_size();
 
     //clear the arrays
    for(int i=0; i<3; i++)
        for(int j=0; j<4; j++)
            stickman[i][j] = ' ';

     //The stickman
     stickman[0][1] = 'O';
     stickman[1][0] = '-';
     stickman[1][1] = '+';
     stickman[1][2] = '-';
     stickman[2][1] = '^';
     stickman[0][3] = '\0';
     stickman[1][3] = '\0';
     stickman[2][3] = '\0';

     while(true)
     {
          direction = rand()%4;
          cout << direction << endl;

          switch(direction)
          {
               //Test the x,y coordinates to keep it on the screen
               case up:     if(y>=0)  {y--; } else{y+=3;} cout << "up";    break;
               case right:  if(x<=120){x+=3;} else{x-=3;} cout << "right"; break;
               case down:   if(y<=153){y++; } else{y-=3;} cout << "down";  break;
               case left:   if(x>=3)  {x-=3;} else{x+=3;} cout << "left";  break;          
          }

          //Draw stickman
          cout << endl << "x=" << x << ", y=" << y;
          gotoxy(x,y);   cout << stickman[0];
          gotoxy(x,y+1); cout << stickman[1];
          gotoxy(x,y+2); cout << stickman[2];

          Sleep(500);
          system("cls");
     }
}



void gotoxy(int x, int y)
{
     COORD coord;
     coord.X = x;
     coord.Y = y;
     SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

void set_console_size()
{
     HANDLE hOut;
     SMALL_RECT DisplayArea = {0, 0, 0, 0};
     //set x and y to whatever ye' want
     int x = 125;
     int y = 55;

     hOut = GetStdHandle(STD_OUTPUT_HANDLE);
     DisplayArea.Right  = x;
     DisplayArea.Bottom = y;

     SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
Clinton Portis 211 Practically a Posting Shark

New and improved version:

#include <iostream>
#include <windows.h>
using namespace std;

enum{up, right, down, left};
int direction = 0;
int x = 20,
    y = 10;

srand(time(NULL));

char stickman[3][4];

//clear the arrays
for(int i=0; i<3; i++)
   for(int j=0; j<4; j++)
       stickman[i][j] = ' ';     
   
//The stickman
stickman[0][1] = 'O';
stickman[1][0] = '-';
stickman[1][1] = '+';
stickman[1][2] = '-';
stickman[2][1] = '^';
stickman[0][3] = '\0';
stickman[1][3] = '\0';
stickman[2][3] = '\0';

while(true)
{
     direction = rand()%4;

     switch(direction)
     {
          //Test the x,y coordinates to keep it on the screen
          case up:     if(y>0)  {y--;}  break;
          case right:  if(x<123){x++;}  break;
          case down:   if(y<152){y++;}  break;
          case left:   if(x>0)  {x--;}  break;
     }

     gotoxy(x,y);   cout << stickman[0]; 
     gotoxy(x++,y); cout << stickman[1]; 
     gotoxy(x++,y); cout << stickman[2]; 

     Sleep(800);
     system("cls");
}

void gotoxy(int x, int y)
{
     COORD coord;
     coord.X = x;
     coord.Y = y;
     SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord);
}

void set_console_size()
{
     HANDLE hOut;
     SMALL_RECT DisplayArea = {0, 0, 0, 0};
     //set x and y to whatever ye' want
     int x = 125;
     int y = 55;

     hOut = GetStdHandle(STD_OUTPUT_HANDLE);
     DisplayArea.Right  = x;
     DisplayArea.Bottom = y;

     SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
Clinton Portis 211 Practically a Posting Shark

what you are trying to do is suprisingly not that difficult. this type of ascii game will involve some simple techniques. in any animated ascii game, it's just a matter of clearing and re-drawing the screen. you will need simple collision detection to tell when you've hit the enemy. you've mentioned that you need random movement for your enemy, here is a simple code that moves a stick figure around the screen:

#include <iostream>
#include <windows.h>
using namespace std;

enum{up, right, down, left};
int direction = 0;
int x = 20,
    y = 10;

srand(time(NULL));

char stickman[3][4];

//clear the arrays
for(int i=0; i<3; i++)
   for(int j=0; j<4; j++)
       stickman[i][j] = ' ';     
   
//The stickman
stickman[0][1] = 'O';
stickman[1][0] = '-';
stickman[1][1] = '+';
stickman[1][2] = '-';
stickman[2][1] = '^';
stickman[0][3] = '\n';
stickman[1][3] = '\n';
stickman[2][3] = '\0';

while(true)
{
     direction = rand()%4;

     switch(direction)
     {
          //Test the x,y coordinates to keep it on the screen
          case up:     if(y>0)  {y--;}  break;
          case right:  if(x<123){x++;}  break;
          case down:   if(y<152){y++;}  break;
          case left:   if(x>0)  {x--;}  break;
     }

     gotoxy(x,y); cout << stickman; 
     Sleep(800);
     system("cls");
}

void gotoxy(int x, int y)
{
     COORD coord;
     coord.X = x;
     coord.Y = y;
     SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord);
}

void set_console_size()
{
     HANDLE hOut;
     SMALL_RECT DisplayArea = {0, 0, 0, 0};
     //set x and y to whatever ye' want
     int x = 125;
     int y = 55;

     hOut = GetStdHandle(STD_OUTPUT_HANDLE);
     DisplayArea.Right  = x;
     DisplayArea.Bottom = y;

     SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}

I gave you a few tools from the <windows.h> …

Clinton Portis 211 Practically a Posting Shark

#include <string>

Clinton Portis 211 Practically a Posting Shark

what i would do in this situation is read in the entire line using getline(), and then break the line down and store it as you desire.

here is a possible pseudocode:

1) read in the entire line
2) based on your text file format, we can assume the first word will always be a last name, store the first word into string last_name.
3) the second word will need to be tested in order to identify it as a possible suffix (jr. II, sr. etc.). pass the second word into a bool is_suffix(string word) function, if this function returns true, append the word to string last_name else store the word in string first_name.
4) assume any remaining data to be the middle name or initial. store it accordingly.

probably the best way to perform the string parsing is to use a <stringstream> object:

#include <stringstream>

stringstream ss;
string line,
       first_name[69],
       last_name[69],
       middle[69],
       temp;
int i=0;

while(getline(infile, line))
{
     ss << line;
     last_name[i] << ss;
     temp << ss;
     if(is_suffix(temp))
     {
          last_name[i] += ' ';
          last_name[i] += temp;
     }
     else
     {
          first_name[i] = temp;
     }
     middle[i] << ss;
     i++;
}
Clinton Portis 211 Practically a Posting Shark
Clinton Portis 211 Practically a Posting Shark
string lines[69];

int i=1;
while(getline(infile, lines[i]))
{
     i++;
}
Clinton Portis 211 Practically a Posting Shark

I tried ur code but it is not working.

sorry.

Clinton Portis 211 Practically a Posting Shark

I tried to give ye' some guidance with pseudocode... but trying to explain the loop conditions and array indicies seemed to be awkward and would have only added to your confusion. So I will give you one free of charge. Give the other 2 problems a chance on your own and show us what you come up with.

Compute Sum:

int compute_sum(int array[])
{
     int var = 0;

     for(int i=0; i<size; i++)
     {
          var += array[i];
     }

     return var;
}
Clinton Portis 211 Practically a Posting Shark
vector<int> my_vector;

for(int i=0; i<69; i++)
{     
     my_vector.push_back(i);
}

//now change it
for(int i=0, size=my_vector.size(); i<size; i++)
{
     my_vector[i] *= 2;
}
Clinton Portis 211 Practically a Posting Shark
struct object
{
    char beer;
}temp_object;

for(int i=0; i<69; i++)
{
     temp_object.beer = value;
     my_vector.push_back(temp_object);
}

//now change it
for(int i=0, size=my_vector.size(); i<size; i++)
{
     my_vector[i].beer = another_value;
}
Clinton Portis 211 Practically a Posting Shark

i suspect the problem might be file i/o related; however, i do not see any file i/o at all. i suspect these operations occur in the getblock() function (and it's variants) but I am not sure.

one thing i would recommend though, is if you are attempting to use a fstream object more than once.. for a different file, the make sure to clear the object before re-using it.

Clinton Portis 211 Practically a Posting Shark

with limited knowledge of your problem combined with other generalities (such as your 'for loop') one guess i would make is that your loop condition in line #12 seems suspicious. since array elements are zero based, it is somewhat uncommon to see size-1 as a loop condition. this could cause you to examine one less element in your array and therefore return results less than what you would expect.

Clinton Portis 211 Practically a Posting Shark

you have the function double getInput(double[],int); to accept a double array; however, in line #28 you are attempting to pass in a double var.

one solution could be to overload the getInput() function so you would have a version of the function that would accept a double, and one version that would accept a double array.

Clinton Portis 211 Practically a Posting Shark

then just create individual arrays instead of using the struct:

string first_name[100];
string last_name[100];
char m_f[100];
int age[100];
double balance[100];
string address[100];

follow the same general protocol. load each array element with a piece of data from the text file.

it's just that easy.

Clinton Portis 211 Practically a Posting Shark

calculator:
pretty descent. since i have a different coding style i would have done some minor things different, such as instead of using an infinite while(true) loop, i would have done while(toupper(answer) != 'Q') to avoid having to break; out of a loop.

also, i tend to stay away from atoi() and itoa() and use a much more versitle <stringstream> object to make the necessary conversions.

instead of using all the else if() 's you could have probably used a switch case structure to test your input chars.

palindrome:
palindrome checker overall looks good. no suggestions. nicely designed for loop. good use of string class member functions.

Clinton Portis 211 Practically a Posting Shark

Here are the number of turns each player can take:

|     |
p1(1)|p2(1)|p1(2)  
-----------------
     |     |
p2(2)|p1(3)|p2(3)
-----------------
     |     |
p1(4)|p2(4)|p1(5) 
     |     |

So we can conclude that there are 9 maxumum total moves that can be made, the person who goes first has a potential to make a max. of 5 moves; the person who goes second can only make a max. of 4 moves.

So you can keep track of your turn counter by player, or by total moves... it doesn't matter. Once ye' reach your magic number of max. moves that can possibly be made in a game of tictactoe and none of your win functions have tested true, the only possible scenario is a tie.

//If you reached max. number of possible turns
if(turns == 9)
{
     //And no winner is detected...
     if(!columns_check() && !rows_check() && !diags_check())
     {
          //Then you must have a tie.
          tie();
     }
}
Clinton Portis 211 Practically a Posting Shark

If ye' have a windows operating system ye' can do this:

include <windows.h>


void set_console_size()
{
     HANDLE hOut;
     SMALL_RECT DisplayArea = {0, 0, 0, 0};
     //set x and y to whatever ye' want
     int x = 125;
     int y = 55;

     hOut = GetStdHandle(STD_OUTPUT_HANDLE);
     DisplayArea.Right  = x;
     DisplayArea.Bottom = y;

     SetConsoleWindowInfo(hOut, TRUE, &DisplayArea);
}
Clinton Portis 211 Practically a Posting Shark

since you have a known format with with data separated by white spaces, we can create an object to hold each line from the text file:

struct account
{
    //string string char int double string
    string first_name;
    string last_name;
    char m_f;
    int age;
    double balance;
    string address;
};

Now you can load a text file into a data structure of your choice:

vector<account> account_list;

account temp;

while(infile)
{
     infile >> temp.first_name;
     infile >> temp.last_name;
     infile >> temp.m_f;
     infile >> temp.age;
     infile >> temp.balance;
     //since we need to include the white spaces with the address data...
     getline(infile, temp.address);  

     //load the data structure
     account_list.push_back(temp);
}

Here is a simple function to display the data:

void display(vector<account> account_list)
{
     cout << "\n\tFirst\tLast\tGender\tAge\tBalance\tAddress"
          << "\n\t--------------------------------------------------------";

     for(int i=0, size=account_list.size(); i<size; i++)
     {
          cout << account_list[i].first_name << '\t';
          cout << account_list[i].last_name << '\t';
          cout << account_list[i].m_f << '\t';
          cout << account_list[i].age << '\t';
          cout << account_list[i].balance << '\t';
          cout << account_list[i].address << '\t';
          cout << endl;
     }
}