Can someone help please. I have search all the forums about my problem and i cant find answer to it. -Decided to post a thread.
Its about making a lotto program in C using only loop control structures and decision control structes( if..etc.). and most importantly random function. ' :-/Don't even know if that's possible. Its all ican use because its only this far our teacher have taught us. Couldn't hint how to manipulate the code, :?:all i know is that I should have an output that will not display same nos. and still shows 6 random nos.
PLEASE HELP! :sad:

One, i don't get the question? What does the program do? and two, do you seriously want us to do your work? Work on the question, post the code and we'll try to rectify. That's the real purpose of the forum. Hope you get it.

Uh -_-' no, not do the work. I'm new, sorry. My only question is it possible, using only loop control structures and decision control structes and random function. to create a lotto program. That's all. If possible then is thre a way?

I've been thinking. I'm not just gonna let people do all my work. ok?
Here I have not use a loop control structure but, I still don't know how the code should be( what sould i write in else?).
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define p printf
main()
{
clrscr();
int x,y,a,b,c,d,e,f,g;

randomize();
y=(random(55)+1);
p("%d\t",y);

a=(random(55)+1);
if(a!=y)
{
p("%d\t",a);
}
b=(random(55)+1);
if(b!=y&&b!=a)
{
p("%d\t",b);
}
c=(random(55)+1);
if(c!=y&&c!=a&&c!=b)
{
p("%d\t",c);
}
d=(random(55)+1);
if(d!=y&&d!=a&&d!=b&&d!=c)
{
p("%d\t",d);
}
e=(random(55)+1);
if(e!=y&&e!=a&&e!=b&&e!=c&&e!=d)
{
p("%d\t",e);
}
else
{

}


getche();
return 0;
}

And done another code her that uses loop and decision control structure. But I dont know what to put in the if statement.


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define p printf
main()
{
clrscr();
int x,y;
randomize();
for(x=1;x<=6;x++)
{
y=(random(55)+1);
p("%d\t",y);
if(??????)
{
?????
}
}
getche();
return 0;
}

It may be possible, and i strongly feel it is, but i can't tell you for sure unless i don't know the exact problem. you may post the question so other members can help too. But yeah, always post the code you tried. Good Luck.

Of course it's possible. I'll offer advice on how to go about a solution if you provide less vague requirements.

Um..here could you advice me what to put in: else? Anyway is the code correct for the program? Pls help. :(

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define p printf
main()
{
clrscr();
int x,y,a,b,c,d,e,f,g;

randomize();
y=(random(55)+1);
p("%d\t",y);

a=(random(55)+1);
if(a!=y)
{
p("%d\t",a);
}
b=(random(55)+1);
if(b!=y&&b!=a)
{
p("%d\t",b);
}
c=(random(55)+1);
if(c!=y&&c!=a&&c!=b)
{
p("%d\t",c);
}
d=(random(55)+1);
if(d!=y&&d!=a&&d!=b&&d!=c)
{
p("%d\t",d);
}
e=(random(55)+1);
if(e!=y&&e!=a&&e!=b&&e!=c&&e!=d)
{
p("%d\t",e);
}
else
{
?????
}


getche();
return 0;
}

you're not getting it; no one can help you unless you tell us what the program does in the first place, i don't know what lotto 6/55 is.
Post your question in simple language and specify what are the inputs and outputs of the program and what does the program do.
and use code tags. code is hard to read without them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.