help on this program

Pages: 12
.
Last edited on
also to match which statement is better to use to match
Last edited on
Neither. You should use bool arrays or better, drop the arrays altogether.
Hey, are we coming up against the clock? How much time before the project is due?

I think your project is getting closer to the teacher's assignment, but could we get a timeframe?

Joe42, I think you have to work on your idea of bool numbers, remember 0 = false, 1 = true. that's why the teacher wants you to assign the arrays to 1 or 0.

This part above would work, but it's a little clumsy;
1
2
 if ((array[p] == lotto[p]) && (array[p] == 1) && (lotto[p] == 1))
					    match++; 

Instead try this;
1
2
 if (array[p] == lotto[p] && array[p] == 1)
					    match++;

All those parenthesis are not needed, and if array[p] == lotto[p] then you only need to test if one of them is also equal to 1. (does that make sense?)

Take a look at Kazekan's code from earlier on, it's pretty close to what your teacher wants except it doesn't prevent the user from typing in the same number more than once (or from typing a number above 55 or below 1). That can be pretty easily done with a couple of if()'s in the first for() loop.

BTW: Your teacher never mentioned that you couldn't use more than the two arrays, but he/she also never said that your numbers had to show up on the screen in the exact order that they were typed in either. I thought it was kind of neat that they automatically arranged themselves by value in your first code.
Last edited on
Thanks guys....I am now complete with this code, i have already put in the defensive statements......I have figured out what Kazekans was saying about the incrementing thing and therefore i am done now. THANK YOU for all the help
No problem dude, and congrats on getting it finished!
Topic archived. No new replies allowed.
Pages: 12