Author Topic: string generator  (Read 507 times)

0 Members and 1 Guest are viewing this topic.

perkele

  • Intentional Cheater
  • **
  • Posts: 29
    • View Profile
string generator
« on: June 25, 2008, 09:32:38 pm »
ok , does anyone have a program that creates 20 digit strings and prints them into a text file
examble xxxx-xxxx-xxxx-xxxx-xxxx
lines must stay in their position
c++ source code will do also
« Last Edit: June 25, 2008, 10:03:30 pm by perkele »

M. O.

  • Administrator
  • MasstKer
  • *
  • Posts: 9184
    • View Profile
    • http://www.tkc-community.net
Re: string generator
« Reply #1 on: June 26, 2008, 10:26:20 pm »
Just for-loop 1:20 and append a (char) floor rand to the string by every iteration. If you want the - you should either do two for loops 5x4 or make a if(k%4==0) ofile<<"-"; continue; check. However, using continue is usually a bad programming habit.

For text files you just use some function nobody remembers. #include <fstream> and then some output file variable def.
Heckling is an art, and game hacking a science.