04-24-2011, 05:27 PM
hello sir am kavita sir u have give prog for practice in lec 11 u have said that try to use random function n for tossing n die guessing game sir i have form these 2 program plz check it either it right or not and also sir u have said that check is it fair die or not sir it is not fair die according to me it not generate every time random number.according to functionality of random function the number should be change every time when i run my die program it always give write answer when user enter 6 number guessing game of tossing coin #include #include main() { int num,guessNum; cout<<"lets play guessing game of tossing a coin "<<<"select 0 for head"<<<"select 1 for tail"<>num; guessNum=rand()%2; if(guessNum==num) { cout<<"your guess is right it is :"; if(guessNum==1) cout<<"tail"; else cout<<"head"; } else cout<<"your guess is in correct"; } prog#2 guessing game of die #include #include main() { int num,guessNum; cout<<"lets play a guessing game of rolling die:"<<<"please chose any number from 1 to 6:"<>num; guessNum=1+rand()%6; if(guessNum==num) { cout<<"your guess is right it is :"<<<"your guess is in correct"; }
