473,657 Members | 2,287 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 2090
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
2392
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 the data. I would like to use a script language to control the interaction between these c++ objects. I become interested in Python since it can load C++ objects and can even extend C++ classes. However, I am not quite sure to what extent can...
15
4536
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 into or updating in A I would like to force that ATXT is unique with respect to CID, i.e.
7
3335
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 the same element. E.g. <A HREF="#" OnMouseOver="A(); return true" OnMouseOut"B(); return true;"
11
3362
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 needed to add the command "fflush(stdout);" after every command that started with: fprintf(stdout fprintf (stdout fprintf( stdout fprintf ( stdout fprintf ( stdout
2
2502
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 structure supposes to have 2-3 levels. What's easier, to write a serialization method for each class used by the main class and a short method to gather all these XML strings together into one complex string or to use some trick and serialize the...
4
1303
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"). When creating "child.so", some code which needs to be incorporated into each "child.so" comes from "parent.so" itself. I fully control how "parent.so" is built, but the problem is that I want to strip all symbols from "parent.so" before...
16
1863
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 fond of that language. I also have extensive experience with Javascript, HTML, and CSS. I used to do alot of Visual Basic 6, though it's been a while. Here's a list of what I'd like to be able to include all in one screen: -two way serial...
2
1776
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
2547
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 someone to design it. (Thousands of dollars? Tens of thousands? Hundreds of thousands?) We want to create a software program that Home Inspectors would use to create their inspection reports. The concept of the program is somewhat similar to Turbo...
0
8837
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5638
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
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 we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.