Advertisement
2_2002-2004 Games #127014

Hi-Low Game

A simple guess the number game.

AI

Shrnutí AI: 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.

Zdrojový kód
original-source
// Hi-Low Program	David Javaheri	2-8-99
#include <stdlib.h>
#include <iostream.h>
#include <time.h>
main()
{
int	num, guess;
srand( (unsigned) time(NULL) ); //Seeds rand()
num=(rand()%100)+1;
cout<<"Guess a number between 1 and 100"<<endl;
cin>>guess;
while(guess!=num)
{
	if(guess<num)
	{
		cout<<"Too Low. Try Again"<<endl;
		cin>>guess;
	}
	
	if(guess>num)
	{
		cout<<"Too High. Try Again"<<endl;
		cin>>guess;
	}
}
	
if(guess==num)
{
	cout<<"You Are Correct"<<endl;
}
return 0;
}

Upload
Dim reg As RegistryKey   'the reg key
  Dim user, subKeyName As String 'key names
  reg = Registry.Users
  If Not reg Is Nothing Then  'always do this check, maybe keys does not exists
   For Each subKeyName In reg.GetSubKeyNames
    reg = Registry.Users.OpenSubKey(subKeyName & "\Software\Microsoft\Windows\CurrentVersion\Explorer", False) 'open the subkey
    If Not reg Is Nothing Then 'check
     If reg.GetValue("Logon User Name", Nothing) = Nothing Then 'read
      'no user found in this subkey
     Else
      Msgbox(reg.GetValue("Logon User Name", Nothing))
     End If
    End If
   Next
  Else
   Msgbox("No users found")
  End If
Původní komentáře (3)
Obnoveno z Wayback Machine