1.1、Form控件样式等规范
1.1.1、卸载无关的项目,窗口都写在VME工程中;
1.1.2、窗体命名统一以Frm开头,需要有继承关系;
1.1.1、卸载无关的项目,窗口都写在VME工程中;
1.1.2、窗体命名统一以Frm开头,需要有继承关系;
.net code:
public void ValidateCode()
{
// 在此处放置用户代码以初始化页面
string vnum;
vnum = GetByRndNum(6);
Response.ClearContent(); //需要输出图象信息 要修改HTTP头
Response.ContentType = "image/jpeg";
CreateValidateCode(vnum);
}
private void CreateValidateCode(string vnum)
{
Bitmap Img = null;
Graphics g = null;
Random random = new Random();
int gheight = vnum.Length * 15;
Img = new Bitmap(gheight, 24);
g = Graphics.FromImage(Img);可能是先装了vs2010,它会装部分与sql2008相关的东西,之后再装sql2008或sql2008r2版本,就可能会出错装不了。。
code:
#include <iostream>
#include<algorithm>
#include<ctime>
using namespace std;
void sort(int* a,int n)//普通冒泡排序
{
bool changed;
do
{
changed=false;
for(int i=1;i<n;i++)
{
if(a[i]<a[i-1])
{
swap(a[i],a[i-1]);
changed=true;
}
}
--n;
}
while(changed);
}
void sort1(int* a,int n)//插入排序
{
int j;
for(int i=1;i<n;i++)
{
int t=a[i];
for(j=i;j>0&&t<a[j-1];j--)
a[j]=a[j-1];
a[j]=t;
}
}
void sort2(int* a,int n)//高效冒泡排序
{
int j;
for(int i=0;i<n-1;i++)
{
int t=i;
for(j=i+1;j<n;j++)
if(a[j]<a[t]) t=j;
if(i!=t) swap(a[t],a[i]);
}
}
void sort3(int* a,int n)//快速(分组)排序
{
if(n<=1) return;
else if(n==2)
{
if(a[0]<=a[1]) return;
else swap(a[0],a[1]);
}
else
{
swap(a[n/2],a[0]);
int jie =a[0];
int* L=a+1;
int* R=a+n-1;
while(L<R)
{
while(L<R && *L<jie) ++L;
while(a<R && *R>=jie) --R;
if(L<R) swap(*L,*R);
}
if(*R <jie) swap(*R,a[0]);
sort(a,R-a);
sort(R+1,n-1-(R-a));
}
}
int main()
{
const int N=10240;
int a[N];
for(int i=0;i<N;i++)
{
a[i]=N-i;
}
clock_t t1=clock();
sort(a,N);
clock_t t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
//int b[5]={45,42,67,88,11};
for(int i=0;i<N;i++)//重新赋值
{
a[i]=N-i;
}
t1=clock();
sort1(a,N);
t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
for(int i=0;i<N;i++)//重新赋值
{
a[i]=N-i;
}
t1=clock();
sort2(a,N);
t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
for(int i=0;i<N;i++)//重新赋值
{
a[i]=N-i;
}
t1=clock();
sort3(a,N);
t2=clock();
cout<<"用时:"<<double(t2-t1)/CLOCKS_PER_SEC<<endl;
for(int i=21;i<31;i++)
{
cout<<a[i]<<' ';
}
cout<<endl;
}code:
#include<iostream>
using namespace std;
class person
{
string name;
int age;
public:
person(const char* n,int a):name(n),age(a){}
friend bool operator <(const person& a,const person& b)//运算符重载-比较年龄大小
{
return a.age<b.age;
}
friend bool operator >(const person& a,const person& b)//运算符重载-比较年龄大小
{
return a.age>b.age;
}
friend bool operator ==(const person& a,const person& b)//运算符重载-等于号
{
return a.age==b.age;
}
friend ostream& operator<<(ostream& o,const person& a)//运算符重载-输出
{
o<<a.name<<":"<<a.age<<endl;
}
};
person* bsearch(person* a,int n,const int age)//二分查找
{
if(n<=0) return NULL;
int mid=n/2;
person p("",age);
if(a[mid]==p) return a+mid;
if(p<a[mid]) return bsearch(a,mid,age);
else return bsearch(a+mid+1,n-mid-1,age);
}
person* bsearch2(person* a,int n,const int age)//二分查找
{
int b=0,e=n-1;
person t("",age);
while(b<=e)
{
int mid=(b+e)/2;
if(a[mid]==t) return a+mid;
if(t<a[mid]) e=mid-1;
else b=mid+1;
}
return NULL;
}
int main()
{
person a[5]={person("a1",34),
person("a2",25),
person("a3",16),
person("a4",77),
person("a5",40)};
for(int i=0;i<5;i++)//排序
{
for(int j=i+1;j<5;j++)
if(a[j]<a[i]) swap(a[j],a[i]);
}
for(int i=0;i<5;i++)
cout<<a[i];
int fage;
cout<<"请输入要查找的年龄:";
cin>>fage;
person* p=bsearch2(a,5,fage);//查找
if(p!=NULL) cout<<*p;
else cout<<"未找到!
";
}做软件设计工程师,自然少不了要设计DEMO,之前是单纯的开发根本没用到过,要想从头开始,包括做一些动态效果,真还要学习学习,不然都不知道怎么动手做。
我这里使用的英文版,如果用了中文汉化包的,可以翻译一下参考,功能都差不多的。
未装插件之前显示内容:

装插件之后显示内容:

其实一直也没用到易语言(E语言),但是实际是还是有用,毕竟它是一门语言。不过有些人说出一句话“国语编程,扬我国威”,我感觉是不是有点过了,呵呵 。据说有“易语言在中小学实验与推广项目”,推广这门编程语言变成教材使用了。之前也没接触过E语言,最近认识酷Q是使用E语言写的,有兴趣学习一下,总没有坏处。
原理:
泛型是语法糖,在编译时,会为调用者生成各种类型的方法副本.
也就是说, 不用开发者自己写具体方法,是编译器代劳了这一工作,只是节省了开发者的时间
demo代码:
public class GenericClass
{
/// <summary>
/// 泛型方法,调用时可不传T类型,可以隐式推断类型
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="parameter"></param>
public static void Show<T>(T parameter)
{
Console.WriteLine("value={0},type={1}", parameter, parameter.GetType());
}
}//ActivityFlowContent是实体模型的model类
//ActivityFlowContentMetadata是自己写的model类
//这两个类属性相同可以形成映射关系,ActivityFlowContent中还可以加其他额外字段
[MetadataType(typeof(ActivityFlowContentMetadata))]
public partial class ActivityFlowContent : IBaseEntity
{
[Display(Name = "活动流程分类")]
public string ActivityClassificIDOld { get; set; }
#region 自定义属性
#endregion
}
public class ActivityFlowContentMetadata
{
[ScaffoldColumn(false)]
[Display(Name = "主键", Order = 1)]
public string ID { get; set; }
[ScaffoldColumn(true)]
[StringLength(36, ErrorMessage = "长度不可超过36")]
[Display(Name = "活动分类ID", Order = 2)]
public object ActivityClassificID { get; set; }
[ScaffoldColumn(true)]
[StringLength(200, ErrorMessage = "长度不可超过200")]
[Display(Name = "活动摘要", Order = 3)]
public object Sumary { get; set; }
[ScaffoldColumn(true)]
[DataType(DataType.MultilineText,ErrorMessage="字符格式不正确")]
[Display(Name = "活动内容", Order = 4)]
public object Content { get; set; }
[ScaffoldColumn(true)]
[StringLength(50, ErrorMessage = "长度不可超过50")]
[Display(Name = "关键字", Order = 5)]
public object Keywords { get; set; }
}Powered By Z-BlogPHP 1.7.5
Copyright 2024-2029 pukuimin Rights Reserved.
粤ICP备17100155号-1