发布网友 发布时间:2022-04-22 21:27
共5个回答
热心网友 时间:2022-06-18 19:59
1、首先,我们编写C语言的头文件#include <stdio.h>。
2、然后我们编写Main函数框架。
3、接下来我们定义两个变量,如下图所示。
4、然后我们编写输入的函数,如下图所示。
5、接下来在输入后,我们编写输出程序。
6、这时候,我们便可以观察最终结果。
热心网友 时间:2022-06-18 20:00
你可以先看看DirectX 开发包里面的 DirectPlay部分, 里面有个简单的框架. 教你怎么搭建一个小型的 Server/client 程序. 利用这个框架. 你可以写一个简单的QQ.实现局域网中多台机器的聊天和数据传输.
热心网友 时间:2022-06-18 20:00
直接联系马化腾,如果他能给你的话就不需要自己弄了。
热心网友 时间:2022-06-18 20:01
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 07 17:30:58 2015
@author: Dreace
"""
import urllib2
import sys
import time
import os
import random
from multiprocessing.mmy import Pool as ThreadPool
type_ = sys.getfilesystemencoding()
def rename():
return time.strftime("%Y%m%d%H%M%S")
def rename_2(name):
if len(name) == 2:
name = '0' + name
elif len(name) == 1:
name = '00' + name
else:
name = name
return name
def download_pic(i):
global count
global time_out
if Filter(i):
try:
content = urllib2.urlopen(i,timeout = time_out)
url_content = content.read()
file_name = rename_2(repr(count)) + "_" + repr(random.randint(10000,999999999)) + ".jpg"
f = open(file_name,"wb")
f.write(url_content)
f.close()
if os.path.getsize(file_name) >= 1024*11:
count += 1
else:
os.remove(file_name)
except Exception, e:
print e
def Filter(content):
for line in Filter_list:
if content.find(line) == -1:
return True
def get_pic(url_address):
global pic_list
global time_out
global headers
try:
req = urllib2.Request(url = url_address,headers = headers)
str_ = urllib2.urlopen(req, timeout = time_out).read()
url_content = str_.split("\'")
for i in url_content:
if i.find(".jpg") != -1:
pic_list.append(i)
except Exception, e:
print e
MAX = 100
count = 0
time_out = 60
thread_num = 50
pic_list = []
page_list = []
pic_kind = ["hot","share","mm","taiwan","japan","model"]
Filter_list = ["imgsize.ph.126.net","img.ph.126.net","img2.ph.126.net"]
dir_name = "F:\Photos\\"+rename()
os.makedirs(dir_name)
os.chdir(dir_name)
start_time = time.time()
#url_address = "
url_address = "
headers = {"User-Agent":" Mozilla/5.0 (Windows NT 10.0; rv:39.0) Gecko/20100101 Firefox/39.0"}
for pic_i in pic_kind:
for i in range(1,MAX + 1):
page_list.append(url_address + pic_i + "/page/" + repr(i))
page_pool = ThreadPool(thread_num)
page_pool.map(get_pic,page_list)
page_pool.close()
page_pool.join()
print "获取到".decode("utf-8").encode(type_),len(pic_list),"张图片,开始下载!".decode("utf-8").encode(type_)
pool = ThreadPool(thread_num)
pool.map(download_pic,pic_list)
pool.close()
pool.join()
print count,"张图片保存在".decode("utf-8").encode(type_) + dir_name
print "共耗时".decode("utf-8").encode(type_),time.time() - start_time,"s"
#Python2.7.10---httplib2-0.7.7-----
热心网友 时间:2022-06-18 20:01
写不出来的。qq 经历了这么多年的改变,已经不在是简单的一个软件了,他自己也写了很多底层的东西~