海豚号码生成器,你可以佰渡搜一下它的名字,去在线安装一个。
生成的样式多,功能多,速度快,号段全新,升级快。
第一种方式:在线随机生成号码,可以选择省份城市。
第二种方式:生成靓号豹子号,软件提供多种组合格式给你选择,比如AAAA,BAAA,ABAB等。
第三种方式:自定义号段生成,你来输入前七位号段来生成。
---------------------------------分割线--------------------------------
单链表插入排序
//从键盘上输入20个数,把他们按从小到大的顺序存储在链表中,然后输出
#include<iostream>
using namespace std;
struct list
{
int data;
list *link;
};
void List(int n)
{
int temp;
list *p,*first,*q;
first=new list;
first->link=NULL;
int x;
cout<<"请输入数字";
for(int i=0;i<n;i++)
{
p=new list;
cin>>x;
p->data=x;
p->link=first->link;
first->link=p;
}
for(p=first;p;p=p->link)
{
for(q=p->link;q;q=q->link)
{
if(p->data>q->data)
{
temp=p->data;
p->data=q->data;
q->data=temp;
}
}
}
p=first;
cout<<"从小到大输出为";
while(p->link!=NULL)
{
cout<<p->data<<" ";
p=p->link;
}
}
int main()
{
List(5);
system("pause");
return 0;
}
-------------分割线1----------------------
设计一个字符串类MyString
/*设计一个字符串类MyString,使其只有1个私有成员:char *str(指向字符串的指针);
该类具有构造函数、析构函数、复制构造函数,且具有其他成员函数,
a.求取该字符串的长度;
b.可以让两个MyString对象进行拼接;如abc, bcd 拼接成abcbcd
c.比较两个字符串的大小;
d.在指定位置插入另一个字符串;
#include <iostream>
#include <string>
using namespace std;
class MyString
{
public:
MyString();//默认构造函数
MyString(const char *s);//用指针s所指向的字符串常量初始化类的对象。构造函数
MyString(const MyString &rhs);//复制构造函数
unsigned int length() const;//返回字符串的长度
void comp (const MyString p1,const MyString p2) const;//比较大小
void add(const MyString p1,const MyString p2);//将字符串拼接
~MyString(){}
private:
const char *str;
};
MyString::MyString(const char *s)
{
s=" ";
str=s;
}//构造函数的实现,这个函数应该写得不对,但是不知道怎么改
MyString::MyString( const MyString &rhs)
{
str=rhs.str;
} //复制构造函数的实现
unsigned int MyString::length() const
{
int n=0;
while(*(str+n)!='\0')
n++;
return n;
} //输出字符串的长度 */
void MyString::comp(const MyString p1,const MyString p2) const
{
if(p1.str==p2.str)
cout<<"p1=p2."<<endl;
if(p1.str>p2.str)
cout<<"p1>p2."<<endl;
if(p1.str<p2.str)
cout<<"p1<p2."<<endl;
}//比较两个字符串的大小
void MyString::add(const MyString p1,const MyString p2)
{
cout<<(p1.str+p2.str);
}//连接两个字符串*/
int main()
{
MyString myp1("123"),myp2("happy");
cout<<"The length of myp1 and myp2:"<<endl;
cout<<myp1.length()<<" "<<myp2.length()<<endl;
cout<<"Compare myp1 with myp2:"<<endl;
myp1.comp(myp1,myp2);
cout<<"Add myp2 to myp1:"<<endl;
myp1.add;
return 0;
}
------------分割线3---------------
约瑟夫循环
原理很简单,一个代码,是用静态链表实现的,比较简单,这里以13个人为例
#include <stdio.h>
#define N 13
struct person
{
int number;
int nextp;
}link[N+1];
int main()
{
int i,count,h;
for(i=1;i<=N;i++)
{
if(i==N)
link[i].nextp=1; //形成一圈
else
link[i].nextp=i+1; //指示下一个
link[i].number=i; //表示自己编号
}
printf("\n");
count=0;
h=N;
printf("people leave the circle\n");
while(count<N-1)
{
i=0;
while(i!=3)
{
h=link[h].nextp;
if(link[h].number)
i++;
}
printf("%4d",link[h].number);
link[h].number=0;
count++;
}
printf("the last one is ");
for(i=1;i<=N;i++)
if(link[i].number)
printf("%4d",link[i].number);
printf("\n");
return 0;
}
//从键盘上输入20个数,把他们按从小到大的顺序存储在链表中,然后输出
#include<iostream>
using namespace std;
struct list
{
int data;
list *link;
};
void List(int n)
{
int temp;
list *p,*first,*q;
first=new list;
first->link=NULL;
int x;
cout<<"请输入数字";
for(int i=0;i<n;i++)
{
p=new list;
cin>>x;
p->data=x;
p->link=first->link;
first->link=p;
}
for(p=first;p;p=p->link)
{
for(q=p->link;q;q=q->link)
{
if(p->data>q->data)
{
temp=p->data;
p->data=q->data;
q->data=temp;
}
}
}
p=first;
cout<<"从小到大输出为";
while(p->link!=NULL)
{
cout<<p->data<<" ";
p=p->link;
}
}
int main()
{
List(5);
system("pause");
return 0;
}
-------------分割线1----------------------
设计一个字符串类MyString
/*设计一个字符串类MyString,使其只有1个私有成员:char *str(指向字符串的指针);
该类具有构造函数、析构函数、复制构造函数,且具有其他成员函数,
a.求取该字符串的长度;
b.可以让两个MyString对象进行拼接;如abc, bcd 拼接成abcbcd
c.比较两个字符串的大小;
d.在指定位置插入另一个字符串;
#include <iostream>
#include <string>
using namespace std;
class MyString
{
public:
MyString();//默认构造函数
MyString(const char *s);//用指针s所指向的字符串常量初始化类的对象。构造函数
MyString(const MyString &rhs);//复制构造函数
unsigned int length() const;//返回字符串的长度
void comp (const MyString p1,const MyString p2) const;//比较大小
void add(const MyString p1,const MyString p2);//将字符串拼接
~MyString(){}
private:
const char *str;
};
MyString::MyString(const char *s)
{
s=" ";
str=s;
}//构造函数的实现,这个函数应该写得不对,但是不知道怎么改
MyString::MyString( const MyString &rhs)
{
str=rhs.str;
} //复制构造函数的实现
unsigned int MyString::length() const
{
int n=0;
while(*(str+n)!='\0')
n++;
return n;
} //输出字符串的长度 */
void MyString::comp(const MyString p1,const MyString p2) const
{
if(p1.str==p2.str)
cout<<"p1=p2."<<endl;
if(p1.str>p2.str)
cout<<"p1>p2."<<endl;
if(p1.str<p2.str)
cout<<"p1<p2."<<endl;
}//比较两个字符串的大小
void MyString::add(const MyString p1,const MyString p2)
{
cout<<(p1.str+p2.str);
}//连接两个字符串*/
int main()
{
MyString myp1("123"),myp2("happy");
cout<<"The length of myp1 and myp2:"<<endl;
cout<<myp1.length()<<" "<<myp2.length()<<endl;
cout<<"Compare myp1 with myp2:"<<endl;
myp1.comp(myp1,myp2);
cout<<"Add myp2 to myp1:"<<endl;
myp1.add;
return 0;
}
------------分割线3---------------
约瑟夫循环
原理很简单,一个代码,是用静态链表实现的,比较简单,这里以13个人为例
#include <stdio.h>
#define N 13
struct person
{
int number;
int nextp;
}link[N+1];
int main()
{
int i,count,h;
for(i=1;i<=N;i++)
{
if(i==N)
link[i].nextp=1; //形成一圈
else
link[i].nextp=i+1; //指示下一个
link[i].number=i; //表示自己编号
}
printf("\n");
count=0;
h=N;
printf("people leave the circle\n");
while(count<N-1)
{
i=0;
while(i!=3)
{
h=link[h].nextp;
if(link[h].number)
i++;
}
printf("%4d",link[h].number);
link[h].number=0;
count++;
}
printf("the last one is ");
for(i=1;i<=N;i++)
if(link[i].number)
printf("%4d",link[i].number);
printf("\n");
return 0;
}