473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

if some one could help me with this im a noobie

first off i'd like to say i'm vary new at programming and i don't want this but it's my brother that dose its the only thing he asked for, for christmas so please don't make rude comments.
what im trying to do is make a program that would calculate all possible combinations. of numbers from 1-54 basicly he wants all the possible lottery number combinations.i thought it would be easy at first so i said yes to it and i don't want to disapoint him.any way this is what i have so far (below ex 1), the problem is that i dont know how to do it any other way and basicly all it dose is count up to it. i thought that maybe if i just change some of the variables it would do it that way but didn't ( by the way i'm just going over this to tell you what i've already tried so bear with me )then i tried a vector and i couldn't even compile it right that should tell you how new i am at this.so i would appreciate
any help you can give me.
[HTML](ex 1)
#include <iostream>
#include <fstream>

using namespace std;

int main(){
int a,b,c,d,e,f,g,h,i,j;
int max = 54;
for(a=0;a<max;++a){
for(b=0;b<max;++b){
for(c=0;c<max;++c){
for(d=0;d<max;++d){
for(e=0;e<max;++e){
for(f=0;f<max;++f){
cout <<a<<""<<b<<""<<c<<""<<d<<""<<e<<""<<f<<endl;
}}}}}}
}[/HTML]
[HTML](ex 2)
#include <iostream>
#include <vector>

typedef std::vector <int>::size_type sz_t;
typedef unsigned digit_t;

const sz_t size = 10;
const digit_t modulus = 101;

std:stream &
operator << (std:stream & s, const std::vector <digit_t> & v)
{
for (sz_t i = 0, n = v.size (); i != n; ++ i)
(i ? (s << ", ") : s) << v [i];
return s;
}

int main ()
{
std::vector <digit_t> v (size);
while (v.back () != modulus)
{
std::cout <<v<<\n;
++ v.front ();
for (sz_t i = 0; i != size - 1; ++ i) if (v [i] == modulus)
{
v [i] = 0;
++ v [i + 1];
}
}
}[/HTML]
Nov 28 '06 #1
0 992

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

Similar topics

3
by: neilphan | last post by:
Hi Guys, Please HELP! I'm new to PHP and would like to get your professional help! I"m writing simple and small login app using php session variable. I have 3 php scripts. The first is just a...
2
by: osgnamah | last post by:
Hi All; I am getting ready to launch a shareware program in the next few weeks and the last step is going to be creating a website. So the last few days I've been doing some web surfing in...
6
by: Aristotelis E. Charalampakis | last post by:
Hi all, this is a newbie question :-) I was wondering if there was a way to use the switch statement in a manner that each case statement includes more that a simple value. i.e.: switch (...
0
by: cyclopsboi | last post by:
Guys I have a question and any help would be greatly appreciated. I am starting with a small software company doing some web development. they want web access to an application written in c++. ...
0
by: 7Percent | last post by:
Hi, I am just starting using python I was wondering if someone can help me with URL extraction and store it as a variable. Like theres a "<a href="www.google.com"><img src="google.gif"></a> How...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.