-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 363fa7a
Showing
8 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <time.h> | ||
|
||
int main() | ||
{ | ||
int nRand = 0, nGuess = 0, nCount = 0; | ||
srand((unsigned)time(NULL)); | ||
nRand = rand() % 1000 + 1; | ||
printf("请输入1~1000的数字:"); | ||
while (nGuess != nRand) | ||
{ | ||
while (!scanf("%d", &nGuess)) | ||
getchar(); // 防止用户输入非数字导致的死循环 | ||
if (nGuess > nRand) | ||
{ | ||
printf("大了!\n"); | ||
} | ||
else if (nGuess < nRand) | ||
{ | ||
printf("小了!\n"); | ||
} | ||
nCount++; | ||
} | ||
printf("你猜中了!你猜了%d次!\n", nCount); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from random import random | ||
|
||
def main(): | ||
rand_number = int(random() * 1000 + 1) | ||
guess_number = 0 | ||
count = 0 | ||
|
||
print('请输入1~1000的数字:') | ||
while rand_number != guess_number: | ||
guess_number = input() | ||
if guess_number < rand_number: | ||
print('小了') | ||
elif guess_number > rand_number: | ||
print('大了') | ||
count += 1 | ||
print('恭喜你!猜中了!你一共猜测了{}次'.format(count)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import sys | ||
if sys.version_info.major == 3: | ||
from urllib.request import urlopen # Python 3 | ||
else: | ||
from urllib2 import urlopen # Python 2 | ||
|
||
|
||
rsp = urlopen('http://ip.sxisa.com/') | ||
print(rsp.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
html { | ||
min-height: 100%; | ||
position: relative; | ||
} | ||
body { | ||
max-width: 300px; | ||
margin: auto; | ||
font: 300 1em/1.8 PingFang SC,Lantinghei SC,Microsoft Yahei,Hiragino Sans GB,Microsoft Sans Serif,WenQuanYi Micro Hei,sans; | ||
padding: 0 1em; | ||
} | ||
|
||
.logo { | ||
text-align: center; | ||
} | ||
|
||
.logo img{ | ||
width: 100%; | ||
max-width: 300px; /*最大宽度不能大于图片宽度*/ | ||
} | ||
|
||
:focus { | ||
outline: none; | ||
} | ||
|
||
.content .title{ | ||
text-align: center; | ||
font-size: 300%; | ||
font-weight: 100; | ||
} | ||
|
||
.input-text { | ||
border: none; | ||
width: 100%; | ||
text-align: center; | ||
font-size: 1.5em; | ||
border-bottom: 1px dashed #000; | ||
padding: .2em 0; | ||
} | ||
|
||
.submit-btn { | ||
-webkit-appearance: none; /* 取出ios系统按钮默认带有的渐变样式 */ | ||
background-color: #AD190E; | ||
color: #FFF; | ||
border: 0; | ||
width: 100%; | ||
font-size: 1.5em; | ||
padding: .5em; | ||
border-radius: 1.25em; | ||
} | ||
|
||
.submit-btn:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.submit-btn:active { /*实现按下时按钮收缩效果*/ | ||
padding: .45em; | ||
margin: .05em; | ||
} | ||
|
||
.tip { | ||
text-align: center; | ||
} | ||
|
||
.tip a { | ||
color: #CCC; | ||
text-decoration: none; | ||
} | ||
|
||
footer { | ||
text-align: center; | ||
color: #CCC; | ||
height: 4em; | ||
} | ||
|
||
footer p { | ||
font-size: 80%; | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
left: 0; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>报名查询</title> | ||
<link rel="stylesheet" href="css/style.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1 class="logo" ><img src="img/logo.png" alt=""></h1> | ||
</header> | ||
<section class="content"> | ||
<h1 class="title">报名查询</h1> | ||
<form action="#" method="post"> | ||
<p><input placeholder="电话" type="text" name="phone" id="phone" class="input-text"></p> | ||
<p><button class="submit-btn" type="button">查询</button></p> | ||
</form> | ||
<p class="tip"><a href="#">没查到报名?点击这里前往报名→</a></p> | ||
</section> | ||
<footer> | ||
<p>Copyright © 2018 <br/> All Rights Reserved Powered By ISA.</p> | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 创软俱乐部项目训练 | ||
|
||
[后端] 3/21 猜数字 | ||
|
||
猜数字是已一个古老的游戏,由一个出题者随机出一个数字,由猜题者猜,若所猜数字大于所出数字,则出题者回答『大了』;若小于,则回答『小了』;直到猜题者猜中。现在请编写程序模拟出题者,随机数字在0~1000之间。当使用者猜中时,同时打印出猜测次数。 | ||
|
||
[爬虫] 3/21 获取IP | ||
|
||
访问网站:ip.sxisa.com 可以得到本机的外网IP。现在,请编写程序,打印出本机的外网IP。 | ||
|
||
[前端] 3/21 网站设计 | ||
|
||
按照设计图:https://coding.net/s/576fc1e8-5f9f-4863-8b5a-87adcc2e8e80 | ||
制作出对应的网页。 | ||
|
||
--- | ||
|
||
[后端] 4/11 保存猜数字成绩 | ||
|
||
修改上一个程序,添加如下功能: | ||
1. 当用户猜到数字之后,提示其输入一个昵称作为游戏名称,然后保存成绩,包含昵称,开始时间,耗时,所猜数字,猜测次数; | ||
2. 游戏开启时,若用户已有设置了昵称,则输出提示语:你好!昵称~; | ||
3. 然后提示选择 1. 玩猜数字;2. 查看历史成绩;3. 更改设置昵称; | ||
4. 实现2,3功能。 | ||
|
||
[爬虫] 3/29 获取IP与IP相关信息 | ||
|
||
爬取 www.myip.cn 得到本机的外网IP,IP 地域,运营商。 | ||
|
||
[前端] 3/29 表单验证 | ||
|
||
修改上一个网页,添加如下功能: | ||
当用户输入的电话号码非数字与长度不等于11位时,提示无效的手机号,同时禁用按钮,当输入符合要求时,则按钮恢复可用。 |