473,503 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Complicated Program

32 New Member
I want my program to have numbers 1 through 10. I want it to have a sets of 5 numbers and list all the combinations that it can have. I don't want one number to be use twice in a set. This is what i have so far.
Expand|Select|Wrap|Line Numbers
  1. array [x]
  2. int x = 0;
  3. x = rand();
  4.  
  5.     while (x<0 && x<10)
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
Dec 11 '07 #1
1 2084
primeSo
35 New Member
I want my program to have numbers 1 through 10. I want it to have a sets of 5 numbers and list all the combinations that it can have. I don't want one number to be use twice in a set. This is what i have so far.
Expand|Select|Wrap|Line Numbers
  1. array [x]
  2. int x = 0;
  3. x = rand();
  4.  
  5.     while (x<0 && x<10)
  6.  
I am confuse with your question. Do you mean you want to store numbers between 1 to 10 in your array ? if it is the case, you can use : 1+ (rand()%10). This will randomly generate a number between 1 to 10 only one at a time. if you want to initiliaze (fill) your element within your array with integer, you will need a for loop to do it for you. For example:
Expand|Select|Wrap|Line Numbers
  1. for( i = 0 ; i < 10; ++i)
  2.    array[i] = 1 + (rand() %10)
  3.  
Next, you mean you want to have a set of 5 numbers ? is it 5 element within your array ? i am not sure does rand() generates unique number always, but you can try srand() which take in current system time as an parameter, thus, generates unique number from time to time.
Dec 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2376
by: Bo Peng | last post by:
Dear Python group: I am planning on an application that involves several complicated C++ classes. Basically, there will be one or two big data objects and some "action" objects that can act on...
15
4508
by: Agoston Bejo | last post by:
Hi, I'm having trouble with implementing some constraints on the database level. An example: --Table A(AID, BID ref. B.BID, ATXT) --Table B(BID, CID ref. C.CID) --Table C(CID) upon insertion...
7
3316
by: windandwaves | last post by:
Hi Gurus I am trying to make this rather complicated maps with an a huge number of mouseovers and the like. I want to set up a function that OnMouseDown swaps the OnMouseOver and OnMouseOut for...
11
3349
by: No Such Luck | last post by:
I had a situation in a C program, which contained hundreds of calls to "fprintf (stdout, ...", where I needed to flush stdout immediately after any stream was sent there. More specifically, I...
2
2496
by: Just D | last post by:
Hi, I need to write a serialization (to XML string) and restoring (from XML string) of a very complicated object. The object uses a few classes, one class has two ArrayLists, etc. The general...
4
1296
by: Erik Leunissen | last post by:
Hello all, I want to distribute a shared library (lets call it "parent.so"), which, in turn, is used to create shared libs by invoking the GNU linker (lets call these shared libs "child.so"). ...
16
1850
by: nleahcim | last post by:
Hi - I am starting to look at doing something that I think will be amazingly difficult. I ideally would like to do this in C, as that is what I am best in. I can handle C++ but I am not particuarly...
2
1771
by: fAnSKyer/C# newbie | last post by:
I want use C# or even C++, C to do some complicated math works, like calculaus~~ I wander if C# provide any complicated math package, like MATLAB Thanks a lot Cheers fAnS
7
2540
by: adfghergaer | last post by:
First of all, I'm not a programmer. I'm here because I had an idea for a software program that my employer may hire someone to design, and I'm wondering what kind of investment it would take to hire...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.