php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
when user enter 6 number guessing game of tossing coin
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
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"; }
Reply
#2
dear student, yes your view poin is correct to an extent that random function generates random numbers every time executes. As for as your code is concerned it is not complete although logic is correct. Try to compile it in the compiler and if you face any issues then let it know.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  C++ Guessing Game include Number and ABC Vuhelper 0 1,391 06-15-2011, 06:19 PM
Last Post: Vuhelper
  The number in two arrays after taking these number the array sana.pari 1 2,362 04-24-2011, 06:36 PM
Last Post: Support
  write a function to calcute the power of some number, will we only save it or we will sana.pari 2 2,012 04-24-2011, 06:17 PM
Last Post: Support

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support