![]() |
|
#1
|
|||
|
|||
Program that can find a paternI 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
|
|||
|
|||
|
Quote:
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
|
|||
|
|||
|
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
|
|||
|
|||
|
Quote:
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
|
||||
|
||||
|
Quote:
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 GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
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