1.Դ?源码?200
2.求一个c++小程序源代码,要求200行以上,源码给100分,源码能用再加100
3.求VC++源代码,源码unityeditor源码200行左右,源码要有详细注释,源码图片同步源码悬赏!源码!源码!源码
4.C++游戏开发,源码超简单的源码入门项目,200行代码搞定开心消消乐
5.MATLAB全版本安装包详细安装教程附200G源码/视频/讲义
Դ?源码?200
//作者:小斌
#include<graphics.h>
#include<conio.h>
#include<stdlib.h>
//using namespace std;
const char LEFT=0x4b;
const char RIGHT=0x4d;
const char DOWN=0x;
const char UP=0x;
const char ESC=0x1b;
const char ENTER=0x0d;
const int BX=;
const int BY=;
const int SQ=;
const int SQCL=;
const int BkCl=BLUE;
const int SHAP1=2;
const int SHAP2=3;
const int SHAP3=4;
const int SHAP4=5;
void drawxiao(int &x, int &y)
{
int a=x*SQ+BX, b=y*SQ+BY;
setfillstyle(1, SQCL);
bar(a+1, b+1, a+SQ-1, b+SQ-1);
}
void clearxiao(int &x, int &y)
{
int a=x*SQ+BX, b=y*SQ+BY;
setfillstyle(1, BkCl);
bar(a+1, b+1, a+SQ-1, b+SQ-1);
}
void goleft(int &x, int &y)
{
if(x>0)
{
clearxiao(x, y);
drawxiao(--x, y);
}
}
void goright(int &x, int &y)
{
if(x<7)
{
clearxiao(x, y);
drawxiao(++x, y);
}
}
void godown(int &x, int &y)
{
if(y<7)
{
clearxiao(x, y);
drawxiao(x, ++y);
}
}
void goup(int &x, int &y)
{
if(y>0)
{
clearxiao(x, y);
drawxiao(x, --y);
}
}
void end()
{
closegraph();
exit(1);
}
void move(int &x, int &y)
{
int n=1;
drawxiao(x, y);
while(n)
switch(getch())
{
case LEFT :goleft(x, y); break;
case RIGHT :goright(x, y); break;
case DOWN :godown(x, y); break;
case UP :goup(x, y); break;
case ENTER :n=0; break;
case ESC :end();
}
}
void qipan()
{
int i;
setbkcolor(BkCl);
setfillstyle(1, );
for(i=0; i<9; i++)
{
line(BX, i*SQ+BY, BX+8*SQ, i*SQ+BY);
line(i*SQ+BX, BY, i*SQ+BX, BY+8*SQ);
}
}
void shap1(int x, int y)
{
int a=x*SQ+BX, b=y*SQ+BY;
setfillstyle(1, SHAP1);
bar(a+1, b+1, a+SQ-1, b+2*SQ-1);
bar(a-SQ+1, b+1+SQ, a, b-1+2*SQ);
}
void shap2(int x, int y)
{
int a=x*SQ+BX, b=y*SQ+BY;
setfillstyle(1, SHAP2);
bar(a+1, b+1, a+SQ-1, b+2*SQ-1);
bar(a+SQ, b+SQ+1, a+2*SQ-1, b+2*SQ-1);
}
void shap3(int x, int y)
{
int a=x*SQ+BX, b=y*SQ+BY;
setfillstyle(1, SHAP3);
bar(a+1, b+1, a+2*SQ-1, b+SQ-1);
bar(a+SQ+1, b+SQ, a+2*SQ-1, b+2*SQ-1);
}
void shap4(int x, int y)
{
int a=x*SQ+BX, b=y*SQ+BY;
setfillstyle(1, SHAP4);
bar(a+1, b+1, a+2*SQ-1, b+SQ-1);
bar(a+1, b+SQ, a+SQ-1, b+2*SQ-1);
}
void chessboard(int size, int tr, int tc, int dr, int dc)
{
if(size>=2)
{
size=size/2;
if(dc<tc+size)//左边半个棋盘
{
if(dr<tr+size)//左上
{
shap1(tr+size, tc+size-1);
chessboard(size, tr, tc, dr, dc);
chessboard(size, tr+size, tc, tr+size, tc+size-1);
}
else//左下
{
shap2(tr+size-1, tc+size-1);
chessboard(size, tr, tc, tr+size-1, tc+size-1);
chessboard(size, tr+size, tc, dr, dc);
}
chessboard(size, tr, tc+size, tr+size-1, tc+size);
chessboard(size, tr+size, tc+size, tr+size, tc+size);
}
else//在右边半个棋盘
{
if(dr<tr+size)//右上
{
shap3(tr+size-1, tc+size-1);
chessboard(size, tr, tc+size, dr, dc);
chessboard(size, tr+size, tc+size, tr+size, tc+size);
}
else//右下
{
shap4(tr+size-1, tc+size-1);
chessboard(size, tr, tc+size, tr+size-1, tc+size);
chessboard(size, tr+size, tc+size, dr, dc);
}
chessboard(size, tr, tc, tr+size-1, tc+size-1);
chessboard(size, tr+size, tc, tr+size, tc+size-1);
}
}
}
int main()
{
int driver=DETECT, mode;
int x=0, y=0;
initgraph(&driver, &mode, "C:\\JMSOFT\\DRV");
qipan();//画棋盘
move(x, y);//移动特殊方格
chessboard(8, 0, 0, x, y);//覆盖棋盘
getch();
return 0;
}
求一个c++小程序源代码,要求行以上,源码分红楼源码给分,源码能用再加
//=================================[说明]=======================================*/
//学生成绩管理
//文件名:main.cpp
//------!源码!棋牌核心源码!!!海洋IV源码!---------BOF-[程序代码开始]-------------------
#include<iostream>
#include<string>
using namespace std;
//=============<开始定义结构体>===================================================
struct combox
{
int num;
int mark;
string name;
combox *next;
};
//=============<结束定义结构体>===================================================
//=============<开始定义Commonbox类>==============================================
//-----类体开始------------------------
class Commonbox
{
private:
combox *head;
void Swap(combox *,combox *); //交换两个combox变量的数据域
void Print(combox *); //输出一combox指定的记录
combox *Find(int); //查找条例条件的记录,并返回该记录的指针
public:
Commonbox()
{
head=NULL;
}
int ListCount(); //统计当前链表的记录总数,返回一个整数
void AddItem(int num, string name, int mark); //添加一条记录到表尾
void RemoveItem(int); //删除一条指定的记录
void List(); //列出当前链表中的所有记录
void Sort(); //对当前链表进行排序
void Search(int); //在当前链表查找指定记录并输出
float Average(); //计算平均成绩
};
//-----类体结束------------------------
//-----类成员函数开始----------------------------------
int Commonbox::ListCount() //统计当前链表的记录总数,返回一个整数
{
if (! head)return 0;
combox *p=head;
int n=0;
while (p)
{
n++;
p=p->next;
}
return n;
}
void Commonbox::AddItem(int num, string name, int mark) //添加一条记录到表尾
{
if (! head)
{
head=new combox;
head->mark=mark;
head->num=num;
head->name=name;
head->next=NULL;
return;
}
combox *t=head;
while (t && t->num!=num)
t=t->next;
if (t)
{
cout<<"操作失败:学号为"<<num<<"的记录已经存在!"<<endl;
return;
}
combox *p=head;
while (p->next)p=p->next;
combox *p1=new combox;
p1->num=num;
p1->mark=mark;
p1->name=name;
p1->next=NULL;
p->next=p1;
return;
}
void Commonbox::RemoveItem(int num) //删除一条指定的记录
{
combox *t=Find(num);
if (! t)return;
combox *p=head;
//如果要删除的记录位于表头
if (head==t)
{
head=head->next;
delete p;
cout <<"成功删除学号为 "<<num<<" 的记录!"<<endl<<endl;
return;
}
while (p->next!=t)p=p->next;
combox *p1=p->next;
p->next=p1->next;
delete p1;
cout <<"成功删除学号为 "<<num<<" 的记录!"<<endl<<endl;
return;
}
void Commonbox::Print(combox *p) //输出一combox指定的记录
{
cout<<p->num<<"\t\t";
cout<<p->name<<"\t\t";
cout<<p->mark<<endl;
return;
}
void Commonbox::List() //列出当前链表中的所有记录
{
if (ListCount()==0)
{
cout <<"错误:当前的列表为空!"<<endl;
return;
}
combox *p=head;
cout<<"共有记录:"<<ListCount()<<endl;
cout<<"学号\t\t姓名\t\t分数"<<endl;
while (p)
{
Print(p);
p=p->next;
}
cout <<endl;
return;
}
void Commonbox::Search(int num) //在当前链表查找指定记录并输出
{
cout <<"Searching...."<<endl;
combox *p=Find(num);
if (p)
{
cout<<"学号\t\t姓名\t\t分数"<<endl;
Print(p);
}
cout <<endl;
}
combox *Commonbox::Find(int num)
{
if (ListCount()==0)
{
cout <<"错误:当前的列表为空!"<<endl;
return NULL;
}
combox *p=head;
while (p)
{
if (p->num==num)break;
p=p->next;
}
if (! p)
{
cout <<"错误:找不到该记录!\n";
return NULL;
}
return p;
}
void Commonbox::Swap(combox *p1, combox *p2) //交换两个combox变量的数据域
{
combox *temp=new combox;
temp->num=p1->num;
temp->mark=p1->mark;
temp->name=p1->name;
p1->num=p2->num;
p1->mark=p2->mark;
p1->name=p2->name;
p2->num=temp->num;
p2->mark=temp->mark;
p2->name=temp->name;
}
void Commonbox::Sort() //对当前链表进行排序
{
cout <<"Sorting..."<<endl;
if (ListCount()<2) return;
combox *temp=NULL,*p=NULL,*p1=NULL,*p2=NULL,*k=NULL;
int n=ListCount(),i,j;
p=head;
for (i=1;i<n;i++)
{
k=p;
p1=p->next;
for (j=0;j<n-i;j++)
{
if (k->num > p1->num)
{
k=p1;
}
p1=p1->next;
}
if (p!=k)Swap(k,p);
p=p->next;
}
cout <<"Complete successfully!"<<endl<<endl;
return;
}
float Commonbox::Average() //计算平均成绩
{
if (ListCount()==0)
{
cout <<"错误:当前的列表为空!"<<endl;
return -1;
}
int sum=0,n=0;
combox *p=head;
while (p)
{
sum += p->mark;
p=p->next;
n++;
}
return float(sum)/n;
}
//-----类成员函数结束----------------------------------
//=============<结束定义Commonbox类>==============================================
Commonbox student; //定义全局变量
int Menu()
{
cout <<"===========[主选单:]==========="<<endl;
int n=1,select=-1;
cout <<n++<<".输入学生成绩;"<<endl<<endl;
cout <<n++<<".按学号排序;"<<endl<<endl;
cout <<n++<<".按学号查找记录;"<<endl<<endl;
cout <<n++<<".删除由学号指定的记录;"<<endl<<endl;
cout <<n++<<".列出所有记录;"<<endl<<endl;
cout <<n++<<".计算平均成绩;"<<endl<<endl;
cout <<"0.退出;"<<endl<<endl;
cout <<"[请选择(输入相应数字)]:";
cin >>select;
return select;
}
char Exit() //返回一个字符患,用于确认退出
{
char s;
cout<<"确定要退出程序吗?[Y/N]:";
cin >>s;
return s;
}
void Input(int *num, string *name, int *mark) //输入学生信息
{
cout <<"请输入 学号 姓名 分数:";
cin >>*num;
if (*num==-1)return;
cin >>*name>>*mark;
return;
}
void AddNew() //增加记录
{
int num=0,mark=0;
string name="";
cout<<endl<<"当输入的学号为-1时表示结束输入."<<endl;
Input(&num, &name, &mark);
while (num!=-1)
{
student.AddItem(num,name,mark);
Input(&num, &name, &mark);
}
return;
}
void DoFind() //按学号查找
{
int num;
cout<<endl<<"当输入的学号为-1时表示结束输入."<<endl;
do
{
cout <<"请输入要查找的学生的学号: ";
cin>>num;
if (num==-1)continue;
student.Search(num);
}
while (num!=-1);
return;
}
void DoDelete() //删除记录
{
cout<<endl<<"当输入的学号为-1时表示结束输入."<<endl;
int num;
do
{
cout <<"请输入要删除的学生的学号:";
cin>>num;
if (num==-1)continue;
student.RemoveItem(num);
}
while (num!=-1);
return;
}
void ShowAverage() //输出平均数
{
float avr=student.Average();
if (avr>0)
{
cout<<"共有记录:\t"<<student.ListCount()<<endl<<endl;
cout<<"平均成绩:\t"<<avr<<endl<<endl;
}
return;
}
//-------