C Language Program for Stone scissors

Source: Internet
Author: User

// St. cpp: defines console applicationsProgram.
//

# Include "stdafx. H"
# Include "stdlib. H"
# Include "time. H"
# Include "string. H"
# Include "conio. H"
# Include "Dos. H"
// Void initrnd ()
//{
// Char * str1 = "";
// Char * str2 = "";
// Char * str3 = "";
// Char * str4 = "What You output is -";
// Char * str5 = "computer output is -";
// Char * str6 = "match result -";
// Char * str7 = "punch out 1. <stone> 2. <scissors> 3. <Cloth> ";
// Time_t timer = time (0 );
// Struct TM * ptrtime = localtime (& timer );
//
// Printf ("% s \ n \ r", str7 );
// Int user;
// Int computer;
// Scanf ("% d", & User );
// Switch (User)
//{
// Case 1:
// Str1 = "Stone ";
// Break;
// Case 2:
// Str1 = "Scissors ";
// Break;
// Case 3:
// Str1 = "cloth ";
// Break;
// Default:
// Str1 = "You have an error ";
//}
// Srand (unsigned) Time (null ));
// Computer = rand () % 3 + 1;
// Switch (Computer)
//{
// Case 1:
// Str2 = "Stone ";
// Break;
// Case 2:
// Str2 = "Scissors ";
// Break;
// Case 3:
// Str2 = "cloth ";
// Break;
// Default:
// Str2 = "system error ";
//}
//
// If (User-computer =-1 | user-computer = 2 ))
//{
// Str3 = "you win ";
//}
// Else if (User-computer = 0)
//{
// Str3 = "Draw ";
//}
// Else
//{
// Str3 = "You lost ";
//}
//
// Printf ("% S % s \ n", str4, str1, str5, str2, str6, str3 );
// File * FP;
// Fp = fopen ("log.txt", "");
// If (FP = NULL)
//{
// Fp = fopen ("log.txt", "W ");
//}
// Else
//{
// Fputs (str4, FP );
// Fputs (str1, FP );
// Fputs (str5, FP );
// Fputs (str2, FP );
// Fputs (str6, FP );
// Fputs (str3, FP );
// Fputs (asctime (ptrtime), FP );
// Fputc ('\ n', FP );
// Fclose (FP );
//}
//}

Int _ tmain (INT argc, _ tchar * argv [])
{
Int D;
Time_t T;
Srand (unsigned) Time (& T ));*/

D = random (2 );
Printf ("% d", d );
/* Char CHR;
Do {
Initrnd ();
Printf ("do you want to exit y/n? ");
CHR = getchar ();
Scanf ("% C", & CHR );
} While (CHR = 'y' | CHR = 'y ');*/

 


}


// System ("CLS"); clear screen function

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.