High Or Low

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View High Or Low as PDF for free.

More details

  • Words: 228
  • Pages: 2
/* high/low game */ #include #include #include<stdlib.h> /* this program plays a simple game.the computer picks a random number from 0 to 100, and the user tries to guess the number. */ const int totchan=7; void main() { int number; //the computer's random number int guess; //the user's guess int chances=0,score=0,chanscor; //chanscor stores score for 1 successful chance. char ans; do { clrscr(); chances=score=0; cout<<" welcome to the high/low game."; cout<<" i will pick a random number from 0 to 100."; cout<<" you must try to guess the number. "; randomize(); number=(int)(rand()%100); chanscor=100/totchan; //score for each successful chance do { cout<<" what is your guess? (0 to 100) "; cin>>guess; if((guess<0)||(guess>100)) { cout<<"sorry, but your guess "< number) { cout<
cout<<" now you have "<>ans; }while(ans=='y' || ans=='y'); }

Related Documents

High Or Low
October 2019 25
High And Low Selects
May 2020 10
Pl Omaha High Low
December 2019 17
Record High-low Temps
October 2019 19
Low Id To High Id
November 2019 51