摘要:
#define win 0#define mac 1#include <iostream>using namespace std;class button{public: button(){} virtual void createbutton()=0;};class macbutton : public button{public: macbutton(){} virtual void createbutton(){cout<<"macbutton"<<endl;}};class winbutton : public button{pu 阅读全文
摘要:
from HTMLParser import HTMLParserimport sysclass TitleParser(HTMLParser): def __init__(self): self.title = '' self.readingtitle=0 HTMLParser.__init__(self) def handle_starttag(self, tag, attrs): if tag == 'title': self.readingtitle=1 def handle_data(se... 阅读全文
摘要:
import os,sys, urllib2req=urllib2.Request(sys.argv[1])fd=urllib2.urlopen(req)file=open('123.html','w')while 1: data=fd.read(1024) if not len(data): break #sys.stdout.write(data) file.write(data)file.close() 阅读全文
摘要:
import osfile=open("123.txt","r")for line in file.readlines(): print line,file.close()file=open("123.txt","w")file.write("sdfsdfsdf")file.close()file=open("123.txt","a")file.write("erertyerty")file.close()file=open(" 阅读全文
摘要:
import mathprint 12*34+78-132/6print (12*(34+78)-132)/6print (86/40)**5print math.fmod(145,23)print math.sin(0.5)print math.cos(0.5)a=1+2c=4print "1+2=%d" %aprint "1+2=%d,%d" %(a,c) 阅读全文
摘要:
import time#n=input("input a year:")n=time.localtime()[1]'''if n%400==0 or (n%4==0 and n%100!=0): print "yes"else: print "not"'''print n 阅读全文
摘要:
zseven.mfunction out=zseven(nbhd) s=sum(nbhd(:))-nbhd(5); temp1=(2<=s)&(s<=6); p=[nbhd(1) nbhd(4) nbhd(7) nbhd(8) nbhd(9) nbhd(6) nbhd(3) nbhd(2)]; pp=[p(2:8) p(1)]; xp=sum((1-p).*pp); temp2=(xp==1); prod1=nbhd(4)*nbhd(8)*nbhd(2); prod2=nbhd(4)*nbhd(6)*nbhd(2); temp3=(prod... 阅读全文
摘要:
#include <iostream>#include <windows.h>int main(int argc, char* argv[]){ char VolumeInfo[100]; DWORD VolNameSize=100; DWORD VolSerialNumber; DWORD VolMaxComponentLength; DWORD VolFileSystemFlags; char FileSystemNameBuffer[100]; DWORD F... 阅读全文
摘要:
clear all;close all;clc;randn('seed',0);%%一维高斯函数mu=0;sigma=1;x=-6:0.1:6;y=normpdf(x,mu,sigma);plot(x,y);figure;%%二维或多维高斯函数mu=[0 0];sigma=[0.3 0;0 0.35];[x y]=meshgrid(linspace(-8,8,80)',linspace(-8,8,80)');X=[x(:) y(:)];z=mvnpdf(X,mu,sigma);surf(x,y,reshape(z,80,80));hold on;%再生成一个mu 阅读全文
摘要:
clear all;close all;clc;randn('seed',0);%{一维情况mu=0;N=100000;S=5;data=mvnrnd(mu,S,N);me=mean(data);S2=1/N*sum((data-me).^2);%}%%二维或多维情况mu=[0 0];S=[0.3 0;0 0.35];N=10000;data=mvnrnd(mu,S,N);me=mean(data)S1=1/N*sum((data(:,1)-me(1)).^2)S2=1/N*sum((data(:,2)-me(2)).^2) 阅读全文