1.oj是什么
2.求c语言源代码随机产生4张扑克牌 发给2玩家 比大小 对子比杂牌大
3.ojä¸å¯ä»¥çå°èªå·±åç代ç å?
4.jsp登陆界面源代码
oj是什么
OJ,即Online Judge系统,一个用于在线检测程序源代码正确性的平台。通过编译执行代码并使用预设数据进行测试,gradle java插件 源码OJ系统在程序开发过程中发挥关键作用。提交的吉林网站源码代码需在受限环境下运行,包含时间、内存、安全等限制。其起源可追溯至ACM-ICPC国际大学生程序设计竞赛和OI信息学奥林匹克竞赛,用于自动判题与排名。如今,OJ系统广泛应用于全球高校程序设计训练、冰雪之城1.76源码参赛选手训练与选拔、各类程序设计竞赛以及数据结构与算法的学习与作业自动提交判断。
求c语言源代码随机产生4张扑克牌 发给2玩家 比大小 对子比杂牌大
刚才答了一遍:
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int judge(int *A,大型程序源码解析int *B) //A的大返回1,B的大返回2,一样大返回0
{
if((A[0]==A[1])&&(B[0]==B[1]))
{
if(A[0]>B[0]) return 1;
else if(A[0]==B[0]) return 0;
else return 2;
}
else if((A[0]==A[1])&&(B[0]!=B[1]))
{
return 1;
}
else if((A[0]!=A[1])&&(B[0]==B[1]))
{
return 2;
}
else
{
if((A[0]+A[1])>(B[0]+B[1])) return 1;
else if((A[0]+A[1])==(B[0]+B[1])) return 0;
else return 2;
}
}
void getCard(int *A,int *B)
{
A[0]=rand()%+1;
A[1]=rand()%+1;
B[0]=rand()%+1;
B[1]=rand()%+1;
}
int main( void)
{
int A[2] = { 0},B[2] = { 0};
int win;
int ScoreA=,ScoreB=;
srand((unsigned) time(NULL));
do
{
getCard(A,B);
win=judge(A,B);
if(win==1) ScoreA++;
else if(win==2) ScoreB++;
if(ScoreA==)
{
printf("A赢了!!!\n");
break;
}
else if(ScoreB==)
{
printf("B赢了!!!\n");
break;
}
}while(1);
return 0;
}
ojä¸å¯ä»¥çå°èªå·±åç代ç å?
ojä¸å¯ä»¥çå°èªå·±åç代ç ãç»å½OJä¹åï¼è¿å ¥æ们çé¢ç®å表ï¼ç¹å»statusï¼å¨OJä¸ç代ç ä¹è½çãOJæ¯OnlineJudgeç³»ç»çç®ç§°ï¼ç¨æ¥å¨çº¿æ£æµç¨åºæºä»£ç çæ£ç¡®æ§ã
jsp登陆界面源代码
1、login.jsp文件<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>登录页面</title>
</head>
<body>
<form name="loginForm" method="post" action="judgeUser.jsp">
<table>
<tr>
<td>用户名:<input type="text" name="userName" id="userName"></td>
</tr>
<tr>
<td>密码:<input type="password" name="password" id="password"></td>
</tr>
<tr>
<td><input type="submit" value="登录" style="background-color:pink"> <input
type="reset" value="重置" style="background-color:red"></td>
</tr>
</table>
</form>
</body>
</html>
2、聊天app源码演示judge.jsp文件
<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>身份验证</title>
</head>
<body>
<%
request.setCharacterEncoding("GB");
String name = request.getParameter("userName");
String password = request.getParameter("password");
if(name.equals("abc")&& password.equals("")) {
3、afterLogin.jsp文件
%>
<jsp:forward page="afterLogin.jsp">
<jsp:param name="userName" value="<%=name%>"/>
</jsp:forward>
<%
}
else {
%>
<jsp:forward page="login.jsp"/>
<%
}
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>登录成功</title>
</head>
<body>
<%
request.setCharacterEncoding("GB");
String name = request.getParameter("userName");
out.println("欢迎你:" + name);
%>
</body>
</html>
扩展资料:
java web登录界面源代码:1、Data_uil.java文件
import java.sql.*;
public class Data_uil
{
public Connection getConnection()
{
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}catch(ClassNotFoundException e)
{
e.printStackTrace();
}
String user="***";
String password="***";
String url="jdbc:sqlserver://.0.0.1:;DatabaseName=***";
Connection con=null;
try{
con=DriverManager.getConnection(url,user,password);
}catch(SQLException e)
{
e.printStackTrace();
}
return con;
}
public String selectPassword(String username)
{
Connection connection=getConnection();
String sql="select *from login where username=?";
PreparedStatement preparedStatement=null;
ResultSet result=null;
String password=null;
try{
preparedStatement=connection.prepareStatement(sql);
preparedStatement.setString(1,username);
result=preparedStatement.executeQuery();//可执行的 查询
if(result.next())
password=result.getString("password");
}catch(SQLException e){
e.printStackTrace();
}finally
{
close(preparedStatement);
close(result);
close(connection);
}
System.out.println("找到的数据库密码为:"+password);
return password;
}
public void close (Connection con)
{
try{
if(con!=null)
{
con.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public void close (PreparedStatement preparedStatement)
{
try{
if(preparedStatement!=null)
{
preparedStatement.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public void close(ResultSet resultSet)
{
try{
if(resultSet!=null)
{
resultSet.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
}
2、login_check.jsp:文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>验证用户密码</title>
</head>
<body>
<jsp:useBean id="util" class="util.Data_uil" scope="page" />
<%
String username=(String)request.getParameter("username");
String password=(String)request.getParameter("password");
if(username==null||"".equals(username))
{
out.print("<script language='javaScript'> alert('用户名不能为空');</script>");
response.setHeader("refresh", "0;url=user_login.jsp");
}
else
{
System.out.println("输入的用户名:"+username);
String passwordInDataBase=util.selectPassword(username);
System.out.println("密码:"+passwordInDataBase);
if(passwordInDataBase==null||"".equals(passwordInDataBase))
{
out.print("<script language='javaScript'> alert('用户名不存在');</script>");
response.setHeader("refresh", "0;url=user_login.jsp");
}
else if(passwordInDataBase.equals(password))
{
out.print("<script language='javaScript'> alert('登录成功');</script>");
response.setHeader("refresh", "0;url=loginSucces.jsp");
}
else
{
out.print("<script language='javaScript'> alert('密码错误');</script>");
response.setHeader("refresh", "0;url=user_login.jsp");
}
}
%>
</body>
</html>
3、loginSucces.jsp文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO--1">
<title>Insert title here</title>
</head>
<body>
<hr size="" width="%" align="left" color="green">
<font size="6" color="red" >登录成功 </font>
<hr size="" width="%" align="left" color="green">
</body>
</html>
4、user_login.jsp文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO--1">
<title>登录界面</title>
</head>
<body background="C:\Users\win8\workspace\Login\image\9dcbdceab5cfbc_.jpg" >
<center>
<br><br><br><br><br><br>
<h1 style="color:yellow">Login</h1>
<br>
<form name="loginForm" action="login_check.jsp" method="post">
<table Border="0" >
<tr >
<td>账号</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="password">
</td>
</tr>
</table>
<br>
<input type="submit" value="登录" style="color:#BC8F8F">
</form>
</center>
</body>
</html>