GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Mar-2005, 22:13
Anyways Anyways is offline
New Member
 
Join Date: Mar 2005
Posts: 2
Anyways is on a distinguished road

Program that can find a patern


I have a list with a lot of numbers and I would liek to find the patern of those numbers do I can do a number generator with that patern (or aglorithm).

I made a program to put the number in orders, but cant think which code I need to use to find a patern.

The numbers are in TXT file, so can someone please post here a source code which can find that patern (tell me where I have to put the input file (file with the numbers).

Oh yea I forgot to tell you, the numbers are done with 13 character each (0 to 9) and they are separated with - after the 4 character and the 9 one.
example: 3245-42517-7522

Thank you.
  #2  
Old 22-Mar-2005, 09:15
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by Anyways
I have a list with a lot of numbers and I would liek to find the patern of those numbers do I can do a number generator with that patern (or aglorithm).

I see two questions. I think that these are what you would like to know:

1. How to read "stuff" from a text file.

2. How to determine whether one string is a substring of another string.

The answers depend on what language you want to use. (Of course, since C is more-or-less a subset of C++, a properly concocted C program could be used with a C++ compiler, but for instructional purposes that wouldn't seem to be the "right" way.)

Generic answers:

1. The simplest way is to put the text file in the same directory as the executable (the program). Then with C, use fopen(); with C++, use an ifstream.

2. With C use standard library functions strcmp() or strstr() or something similar. With C++ use std::string member functions find() or substr() or something similar.


Now, to get more specific answers, you should ask specific questions:

State the problem precisely: What's the input; what's the output; what do you need to do to get the required output from the specified input.

Show us what you have so far. Tell us specifically what you need to know to complete the task. Ask specific questions.

Tell us what compiler and operating system you are using (sometimes it makes a difference).

Regards,

Dave
  #3  
Old 22-Mar-2005, 15:55
Anyways Anyways is offline
New Member
 
Join Date: Mar 2005
Posts: 2
Anyways is on a distinguished road
Ok here,

my problem is that I need a source code that can help me find the patern(or aglorithm) of a list of numbers (around 5000) so I can use that patern to generate other numbers using the same patern of orginal numbers.

What I am asking is a source code that can do what i am asking.

Can you help?
thanks
  #4  
Old 22-Mar-2005, 17:53
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by Anyways
Ok here,

my problem is that I need a source code that can help me find the patern(or aglorithm) of a list of numbers (around 5000) so I can use that patern to generate other numbers using the same patern of orginal numbers.

What I am asking is a source code that can do what i am asking.

Can you help?
thanks

I'm sorry, but I don't understand what you need to do. Give an example of a pattern that you would look for and how you would use it to generate other numbers.

If you tell us what you need to do, maybe someone can help you get your program to implement the requirements. We are here to help, not to give people source code.

Regards,

Dave
  #5  
Old 23-Mar-2005, 02:11
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,258
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by Anyways
Ok here,

my problem is that I need a source code that can help me find the patern(or aglorithm) of a list of numbers (around 5000) so I can use that patern to generate other numbers using the same patern of orginal numbers.

What I am asking is a source code that can do what i am asking.

Can you help?
thanks
What you are asking for is a very complex algorithm. Can you figure out what the sequence is by looking at it? If so, write down the steps you used to decide what the sequence is. That is your algorithm.

But if you have a different group of numbers, will that sequence of steps still work? This is why your request is extremely complex.

The other problem with the request is we do not give source code. We help you correct the code you are writing when you get stuck.
__________________

Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
 
 

Recent GIDBlogToyota - 2008 November Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 08:44
[TUTORIAL] Calling an external program in C (Linux) dsmith C Programming Language 4 22-Apr-2005 14:30
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 08:10
Please help with my C program to find Pi values mccrbr01 C Programming Language 1 30-Oct-2004 23:47
Need help with a C program (Long) McFury C Programming Language 3 29-Apr-2004 21:06

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:52.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.