whats wrong with this program, i get 2 errors
check the attachments
whats wrong with this program, i get 2 errors
check the attachments
You might want to rephrase your question before this thread turns into this.
There is a lot more information you need to give us before we can help you.
NULL in your srand() should be capiltalized.Code:#include <stdio.h> /* This is how you include standard headers */ #include "myheader.h" /* This is how you include headers in the current directory */
Sent from my iPadŽ
Standard system headers have angle brackets, not quotes:
conio.h is not part of standard C.Code:#include <stdio.h> #include <stdlib.h> #include <time.h>
null should be uppercase. Edit: redundant
totalwinnings is a long, but you use %d instead of %ld.
i don't know how to do it, can somebody run the program and tell me if it is working
Do what? Change a few quotes to angle brackets and capitalize a word?
It's syntax errors... what's the problem here? Yes, when I made the changes, the program worked fine.
Sent from my iPadŽ
ok this what the program was asking
write a program that simulates playing the 6/49 lottery (almost). a 6/49 ticket has six unique
numbers on it between 1 and 49 (inclusive) a ticket cost $1 for each draw. simulate this for
10 years (520 draws)
the program will buy one ticket for each draw(the ticket should have the same numbers in each draw),
for each draw it will generate the winning ticket and compare the numbers
in your ticket against the winning ticket. you win if u match
match winnings
3 numbers out of 6 $10
4 numbers out of 6 $100
5 numbers out of 6 $2000
6 numbers out of 6 $2000000
for each draw, print the week number, the ticket you have bought and the winning ticket,
do the comparison and print "you lost this week" if you lost. if you won, print the winning
in the form "you won %d this week". where %d is replaced by the winnings, at the end of the program
print your total expenses and total winnings.
two functions to use
generateticket() generate a ticket when passed a six element array of ints.
printticket() prints a ticket when passed a six element array of ints
your main should have a line in it that states
srand ((unsigned) time (NULL));
after your variable declaration. this will randomize the result
sample output of the program
week 517
i bought ticket: ticket: 34 35 19 16 41 9
generating winner: ticket: 11 12 28 39 33 32
you lost this week
week 518
i bought ticket: ticket: 34 35 19 16 41 9
generating winner: ticket: 7 20 27 24 5 10
you lost this week
week 519
i bought ticket: ticket: 34 35 19 16 41 9
generating winner: ticket: 42 39 32 23 15 40
you lost this week
week 520
i bought ticket: ticket: 34 35 19 16 41 9
generating winner: ticket: 6 15 12 20 47 16
you lost this week
total expenses are 520
total winnings are 300
is that what the program is given me
Replies to the new code here - http://cboard.cprogramming.com/showthread.php?t=73283
Next time shawn33, paste your code into the forum directly, between [code][/code] tags, and keep to 1 thread if you're still stuck on basically the same problem.