Advertisement
ASP_Volume2 Games #40199

Slot machine Game

A slot machine game created by Kevin Presa. Found at: http://www.cprogramming.com/source.html

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
//Kevin Pre$a
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
int main(void)
	{
	clrscr();
	int t=100;
	int pull=1;
	do{
		cout<<"You have "<<t<<" tokens. Pull?? (1 to pull, 2 to not pull) ";
		cin>>pull;
		if (pull==1)
			t=t-1;
		while (pull==1){
			random;
			int a=random(3)+1;
			random;
			int b=random(3)+1;
			random;
			int c=random(3)+1;
			random;
			int win=random(100)+1;
			
			cout<<"["<<a<<"]"<<" ["<<b<<"]"<<"]"<<" ["<<c<<"]"<<endl;
			if ((a==b) && (b==c) && (a==c))
				cout<<"You won: "<<win<<" tokens";
			else
     {
				cout<<"You lost: "<<(int)(win/10)<<" tokens";
      t=t-(int)(win/10);  //Note that the division is to prevent it
      							 //from working like a real slot machine
                 //That is, the user loses all of his or her
                 //money in a short amount of time.
     }
			if ((a==c) && (b==a) && (b==c))
				t=t+win;
			cout<<endl<<"You have "<<t<<" tokens. Pull?? (1 to pull, 2 to not pull)? ";
			cin>>pull;
			
			}
		}while (pull==1);
		cout<<"Thanks for playing slot machine. Press any key to quit Slot Machine";
		getch();
		return(0);
		}

<% Response.Expires = 0 %> 
<HTML>
<BODY BGColor=Black Text=White>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("guestDSN")
MySQL = "SELECT * FROM paulen"
Set RS = Server.CreateObject("ADODB.Recordset")
rs.Open MySQL, Conn, adOpenStatic, adLockOptimistic
rs.AddNew
rs(0) = Request.QueryString("fld1")
rs(1) = CInt(Request.QueryString("fld2"))
' rs(2) = Request.QueryString("fld3") ' field 3 is a text field, update not supported
rs.Update
%>
<B>New Record:</b><BR>
<%= rs(0) %>
<%= rs(1) %>

</BODY>
</HTML>
Original Comments (3)
Recovered from Wayback Machine