C++ Codes
Algorithms
Algorithm Analysis in C++
Beginners
Code Snippets
Graphics
Data Structures
File Manipulation
Games
Mathematics
Miscellaneous
Visual C++ Library
C++ > Beginners Lab Assignments sample source codes
Number Game in C++.
Number Game in C++. #include
#include
void main() { int s,a,t,o,x=2,c,r,i; char ch; s=t=0,r=22,c=2; clrscr(); cout<<" This is a computer Game. ######################## There are 22 balls on a table,you can take either a "; cout<<"maximum of 4 balls or a minimum of 1 at a time.If you take "; cout<<" the last ball from the table you will WIN other wise Computer .. "; cout<<" Either You or Coputer can Take First ,Enter yr choice I(you)/C(computer) "; cin>>ch; if (ch=='I'|| ch=='i') { i=1,o=1; s: for (;i<17;i++) { cout<<" You:"; cin>>a; switch(a) { case 1: r=r-a; s=s+a; cout<<"Remaining ="<
Privacy Policy
|
Link to Us
|
Links