导航:首页 > 源码编译 > tanlas源码

tanlas源码

发布时间:2022-08-20 04:04:34

Ⅰ 如何运行fortran源代码

你已的编译器已经能够完全正常运行,而且程序也可以运行了呢,只是你不知道如何运行它而已!

在unix或linux下编译fortran,一般系统没有自带fortran的编译器,可以自行安装g77或gfortran编译器,它们是gcc一个系列的,也可以下载单独的g95编译器。

假定你的fortran源程序为hello.for

则输入如下的命令来编译它(g77、gfortran、g95)
g77 hello.for
这样就会在当前目录生成a.out的可执行文件,这样既可执行
./a.out

如果需要指定生成的文件名,可以加个参数-o 来制定文件名,像这样
g77 -o hello hello.for
./hello

明白了吗?unix类操作系统的执行档,并不需要.exe这样的扩展名的。

Ⅱ 用c++实现有界面的计算器,求源代码

我用的是MFC实现的,功能基本上都有了,而且还加了矩阵以及行列式的计算,你适当修改吧。不过这个东西最好自己做才有收获。
下面的代码是核心的部分的代码,我已经写了很久了,所以很多东西都忘记了,还好有注释,最好自己做吧,有了思想,什么都好解决。
你要是有邮箱的话我打包给你,毕竟这个只是一部分,其它的调用你是看不到的。
// MyDialog.cpp : implementation file
//

#include "stdafx.h"
#include "Calculator.h"
#include "MyDialog.h"
#include "math.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// MyDialog dialog
CString str="dddd";
char num[200]; //记录输入的数据
int count=0; //记录数据个数,回退时要减一
char a; //记录操作符
double x,y; //两个操作数
double result; //得到结果
#define PI 3.141592653

MyDialog::MyDialog(CWnd* pParent /*=NULL*/)
: CDialog(MyDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(MyDialog)
str = _T("");
//}}AFX_DATA_INIT
}

void MyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MyDialog)
DDX_Control(pDX, IDC_BUTTON2, m_2);
DDX_Control(pDX, IDC_BUTTON1, m_1);
DDX_Text(pDX, IDC_EDIT1, str);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(MyDialog, CDialog)
//{{AFX_MSG_MAP(MyDialog)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
ON_BN_CLICKED(IDC_BUTTON12, OnButton12)
ON_BN_CLICKED(IDC_BUTTON13, OnButton13)
ON_BN_CLICKED(IDC_BUTTON14, OnButton14)
ON_BN_CLICKED(IDC_BUTTON15, OnButton15)
ON_BN_CLICKED(IDC_BUTTON16, OnButton16)
ON_NOTIFY(MCN_GETDAYSTATE, IDC_MONTHCALENDAR1, OnGetdaystateMonthcalendar1)
ON_BN_CLICKED(IDC_BUTTON17, OnButton17)
ON_BN_CLICKED(IDC_BUTTON18, OnButton18)
ON_BN_CLICKED(IDC_BUTTON19, OnButton19)
ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2)
ON_BN_CLICKED(IDC_BUTTON20, OnButton20)
ON_BN_CLICKED(IDC_BUTTON21, OnButton21)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// MyDialog message handlers
void MyDialog::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here
// GetDlgItem(IDC_EDIT1)-> SetWindowText(str);
// CEdit* pBoxOne;
// pBoxOne = (CEdit*) GetDlgItem(IDC_EDIT1);
// pBoxOne->SetWindowText(str);
}

void MyDialog::OnButton1()
{
// TODO: Add your control notification handler code here
str=str+"1";
num[count]='1';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton2()
{
// TODO: Add your control notification handler code here
str=str+"2";
num[count]='2';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);

}

void MyDialog::OnButton3()
{
// TODO: Add your control notification handler code here
num[count]='3';
++count;
str=str+"3";
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton4()
{
// TODO: Add your control notification handler code here
num[count]='4';
++count;
str=str+"4";
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton5()
{
// TODO: Add your control notification handler code here
str=str+"5";
num[count]='5';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton6()
{
// TODO: Add your control notification handler code here
str=str+"6";
num[count]='6';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton7()
{
// TODO: Add your control notification handler code here
str=str+"7";
num[count]='7';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton8()
{
// TODO: Add your control notification handler code here
str=str+"8";
num[count]='8';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton9()
{
// TODO: Add your control notification handler code here
str=str+"9";
num[count]='9';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton10()
{
// TODO: Add your control notification handler code here
str=str+"0";
num[count]='0';
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton11()
{
// TODO: Add your control notification handler code here
str=str+".";
++count;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton12() //等号
{
// TODO: Add your control notification handler code here
char c;
c=a;
y=0;
for(int i=0;i<count;++i)
{
y=(num[i]-48)+y*10;
}
count=0;
switch(c)
{
case'+':
result=x+y;break;
case'-':
result=x-y;break;
case'*':
result=x*y;break;
case'/':
{
if(y==0)
{
str="除数为0 ! 出错 !";
goto Lable;
}
result=x/y;break;
}
default:
break;
}
str.Format("%f",result);
Lable:
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
str="";
}

void MyDialog::OnButton13()
{
// TODO: Add your control notification handler code here
str=str+"+";
a='+';
x=0;
for(int i=0;i<count;++i)
{
x=(num[i]-48)+x*10;
}
count=0;
// str.Format("%f",x);
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton14()
{
// TODO: Add your control notification handler code here
str=str+"-";
a='-';
x=0;
for(int i=0;i<count;++i)
{
x=(num[i]-48)+x*10;
}
count=0;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton15()
{
// TODO: Add your control notification handler code here
str=str+"*";
a='*';
x=0;
for(int i=0;i<count;++i)
{
x=(num[i]-48)+x*10;
}
count=0;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton16()
{
// TODO: Add your control notification handler code here
str=str+"/";
a='/';
x=0;
for(int i=0;i<count;++i)
{
x=(num[i]-48)+x*10;
}
count=0;
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
}

void MyDialog::OnButton17()
{
// TODO: Add your control notification handler code here
x=0;
for(int i=0;i<count;++i)
{
x=(num[i]-48)+x*10;
}
x=x*PI/180; //转换为弧度
result=sin(x);
str.Format("%f",result);
GetDlgItem(IDC_EDIT1)->SetWindowText(str); //在EDIT文本框中显示数据
count=0;
str="";
}

void MyDialog::OnButton18()
{
// TODO: Add your control notification handler code here
x=0;
for(int i=0;i<count;++i)
{
x=(num[i]-48)+x*10;
}
x=x*PI/180; //转换为弧度
result=cos(x);
str.Format("%f",result);
GetDlgItem(IDC_EDIT1)->SetWindowText(str); //在EDIT文本框中显示数据
count=0;
str="";
}

void MyDialog::OnButton19()
{
// TODO: Add your control notification handler code here
x=0;
for(int i=0;i<count;++i)
{
x=(num[i]-48)+x*10;
}
x=x*PI/180; //转换为弧度
result=tan(x);
str.Format("%f",result);
GetDlgItem(IDC_EDIT1)->SetWindowText(str); //在EDIT文本框中显示数据
count=0;
str="";
}

void MyDialog::OnGetdaystateMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here

*pResult = 0;
}

///有关于求逆矩阵的函数
int numbers=0; //记录矩阵元素的个数

void MyDialog::OnChangeEdit2()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here

}

void MyDialog::OnButton20()
{
// TODO: Add your control notification handler code here

int i=0,j=0;
CString str1="";
//*************************统计整数个数!************************
GetDlgItem(IDC_EDIT2)->GetWindowText(str);
while(str[i]!=';')
{
++i;
if(str[i]==',')
{
++j;
}
}
++j;
numbers=j;
int n;
if(Judge(numbers)) //矩阵元素个数符合要求
{
// str.Format("%d",numbers);
// GetDlgItem(IDC_EDIT1)->SetWindowText(str);
n=sqrt(numbers);
}
else
{
str1="元素个数有误 ! 请在已经输入的基础上改正 !";
GetDlgItem(IDC_EDIT1)->SetWindowText(str1);
str1="";
}
//*************************************************

}

bool MyDialog::Judge(int numbers) //判断矩阵的元素个数是否符合条件,及是否是n X n的矩阵
{
if(numbers!=int(sqrt(numbers))*int(sqrt(numbers)))
{
return 0;
}
else
return 1;
}

void Hanglieshi(double **a,int N); //求行列式的值,使用以前的代码,在函数参数方面有点调整
void plus(double **a,double **b,double **c,int m,int n);//m x n 的矩阵相加
void multiply(double **a,double **b,double **result,int m,int n,int l);//m x n 的矩阵 与 n x l 的矩阵的乘积
double **allocation(int m,int n); //动态分配二维数组,大小:m x n
void swap(double **a,int m,int n,int N); //交换m行和n行的内容
void add(double **a,int m,int n,int N); //把第n行加到第m行上面
void jian(double **a,int m,int n,double x,int N); //用m行减去n行的k倍
int judgeZero(double **a,int j,int N); //返回j列没有0的元素的位置
void dealZero(double **a,int N); //判断主对角线是否有值为0的元素,如果有,则加上对应列上没有0的行
void dealArray(double **a,int N); //将行列式化为上三角行列式
double jieguo(double **a,int N); //主对角线元素之积,即行列式的值

void MyDialog::OnButton21() //求行列式的值
{
// TODO: Add your control notification handler code here
int i=0,j=0;
double res;
CString str1="";
CString str2="";
//*************************统计整数个数!************************
GetDlgItem(IDC_EDIT2)->GetWindowText(str1); //str1为文本框中的数据字符串
while(str1[i]!=';')
{
++i; //统计总字符个数
if(str1[i]==',')
{
++j; //统计整数个数
}
}
++j;
int N=i;
numbers=j;

int num;
if(Judge(numbers)) //矩阵元素个数符合要求
{
str.Format("%d",numbers);
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
num=sqrt(numbers);
double **a; // 动态二维数组
double var; //转换使用的变量
int m,n,l;
m=n=num;
a=allocation(m,n);
//***************************无法解决转换中出现的问题,设置临时一维数组参与转换,然后再赋值到二维数组中
double *Arr=new double[numbers];
//
m=0;
n=0;
str2=str1;
i=0;
while(1) //对数组进行赋值
{
if(str2[n]!=',')
{
var=atoi(str2);
Arr[m]=var;
++m;
++n;
}
else
{
str2="";
for(l=i;l<N;++l) //将文本框里面的已经转换的数据去掉,取其余下的部分
{
str2=str2+str1[l];
}
n=0;
}
++i;
if(i==N+1)
break;
}
// str.Format("%f",Arr[1]); //调试时使用
// GetDlgItem(IDC_EDIT1)->SetWindowText(str);

m=0;
for(i=0;i<num;++i)
{
for(j=0;j<num;++j)
{
a[i][j]=Arr[m];
++m;
}
}

// str.Format("%f",Arr[3]); //调试时使用
// GetDlgItem(IDC_EDIT1)->SetWindowText(str);

n=num;
Hanglieshi(a,n);
var=jieguo(a,n);
str.Format("%f",var);
GetDlgItem(IDC_EDIT1)->SetWindowText(str);
delete []Arr;
}
else
{
str1="元素个数有误 ! 请在已经输入的基础上改正 !";
GetDlgItem(IDC_EDIT1)->SetWindowText(str1);
str1="";
}
}

//*******************行列式求值部分
/*void print(double **a,int m,int n)//输出m x n 的矩阵的内容
{
for(int i=0;i<m;++i)
{
for(int j=0;j<n;++j)
{
cout<<setw(3)<<a[i][j];
}
cout<<endl;
}
}
*/
void plus(double **a,double **b,double **c,int m,int n)//m x n 的矩阵相加
{
for(int i=0;i<m;++i)
{
for(int j=0;j<n;++j)
{
c[i][j]=a[i][j]+b[i][j];
}
}
}

void multiply(double **a,double **b,double **result,int m,int n,int l)//m x n 的矩阵 与 n x l 的矩阵的乘积
{
// cout<<"两个矩阵相乘的结果为: "<<endl;
int i,j,k;
for(i=0;i<m;++i)
{
for(j=0;j<l;++j)
{
result[i][j]=0;
for(k=0;k<n;++k)
{
result[i][j]=result[i][j]+a[i][k]*b[k][j];
}
}
}
}

double **allocation(int m,int n) //动态分配二维数组,大小:m x n
{
double **a;
a=new double *[m];
for(int i=0;i<m;++i)
{
a[i]=new double [n];
}
return a;
}
/*
void printArray(double **a,int N) //输出矩阵内容
{
for(int i =0 ; i<N ; ++i )
{
for(int j = 0; j<N; ++j)
cout<<a[i][j]<<" ";
cout<<endl;
}
cout<<endl;
}
*/
void swap(double **a,int m,int n,int N) //交换m行和n行的内容
{
int i,j;
double *temp=new double[N];
for(j=0;j<N;++j)
{
temp[j]=a[m][j];
a[m][j]=a[n][j];
a[n][j]=temp[j];
}

}

void add(double **a,int m,int n,int N) //把第n行加到第m行上面
{
int i;
for(i=0;i<N;++i)
{
a[m][i]+=a[n][i];
}
}

void jian(double **a,int m,int n,double x,int N) //用m行减去n行的k倍
{
for(int j=0;j<N;++j)
{
a[m][j]=a[m][j]-x*a[n][j];
}
}

int judgeZero(double **a,int j,int N) //返回j列没有0的元素的位置
{
int i;
for(i=0;i<N;++i)
{
if(a[i][j]!=0)
return i;
}
return -1; //如果某一列都为0的话
}

void dealZero(double **a,int N) //判断主对角线是否有值为0的元素,如果有,则加上对应列上没有0的行
{
int j,m=-1;
for(j=0;j<N;++j)
{
if(a[j][j]==0)
{
m=judgeZero(a,j,N);
if(m==-1)
;
// cout<<"行列式的值为0 !"<<endl;
else
{
add(a,j,m,N);
}
}
}
}

void dealArray(double **a,int N) //将行列式化为上三角行列式
{
int i,j;
double x;
for(i=0;i<N-1;++i)
{
for(j=i+1;j<N;++j)
{
if(a[i][i]==0)
break;
x=a[j][i]/a[i][i];
jian(a,j,i,x,N);
}
}
}

double jieguo(double **a,int N) //主对角线元素之积,即行列式的值
{
double r=1;
for(int i=0;i<N;++i)
r*=a[i][i];
return r;
}

void Hanglieshi(double **a,int N) //求行列式的值,使用以前的代码,在函数参数方面有点调整
{
// printArray(a,N);
dealZero(a,N);

dealArray(a,N);
// printArray(a,N);

// cout<<jieguo(a,N)<<endl<<endl;
}

Ⅲ 跪求一个用vb设计的有三角函数功能的计算器,需要源代码,最好是有课程设计,期末作业你懂的!

'给你在msdn上找了一下函数定义并整理了一下,可以用combo做个函数列表用select case调用函数,或者用command控件数组调用函数,接下来的就是纯体力活了,调用函数是注意数据类型,可能是弧度也可能是角度。
sin 基本函数
cos 基本函数
tan 基本函数
atn 基本函数
Secant(正割) Sec(X) = 1 / Cos(X)
Cosecant(余割) Cosec(X) = 1 / Sin(X)
Cotangent(余切) Cotan(X) = 1 / Tan(X)
Inverse Sine(反正弦) Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine (反余弦) Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant (反正割) Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 * Atn(1))
Inverse Cosecant (反余割) Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 * Atn(1))
Inverse Cotangent (反余切) Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine (双曲正弦) HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine (双曲余弦) HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent (双曲正切) HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant (双曲正割) HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant(双曲余割) HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent(双曲余切) HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine(反双曲正弦) HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine(反双曲余弦) HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent(反双曲正切) HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant(反双曲正割) HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant (反双曲余割) HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X)
Inverse Hyperbolic Cotangent (反双曲余切) HArccotan(X) = Log((X + 1) / (X - 1)) / 2

Ⅳ 谁知道通达信函数tan与slope的区别源代码计算原理如何

tan是一个角的正切值。而slope是线性回归的斜率,即
y=ax+b
中的
a。在若干个自变量X与其对应的因变量Y值,通过计算出其近似的
y=ax+b
关系。
==================
补充:
请参阅:网络——回归分析法
http://ke..com/view/540285.htm#sub540285

java 写的计算器源代码只实现加减乘除四则运算即可

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Vector;
public class calculator
{
String str1="0"; //运算数1 初值一定为0 为了程序的安全
String str2="0"; //运算数2
String fh="+"; //运算符
String jg="";//结果
//状态开关 重要
int k1=1;//开关1 用于选择输入方向 将要写入str2或 str2
int k2=1;//开关2 符号键 次数 k2>1说明进行的是2+3-9+8 这样的多符号运算
int k3=1;//开关3 str1 是否可以被清0 ==1时可以 !=1时不能被清0
int k4=1;//开关4 str2 同上
int k5=1;//开关5 控制小数点可否被录入 ==1时可以 !=1 输入的小数点被丢掉
JButton jicunqi; //寄存器 记录 是否连续按下符号键
Vector vt=new Vector(20,10);
JFrame frame=new JFrame("sunshine---计算器");
JTextField jg_TextField=new JTextField(jg,20);//20列
JButton clear_Button=new JButton("清除");
JButton button0=new JButton("0");
JButton button1=new JButton("1");
JButton button2=new JButton("2");
JButton button3=new JButton("3");
JButton button4=new JButton("4");
JButton button5=new JButton("5");
JButton button6=new JButton("6");
JButton button7=new JButton("7");
JButton button8=new JButton("8");
JButton button9=new JButton("9");
JButton button_Dian=new JButton(".");
JButton button_jia=new JButton("+");
JButton button_jian=new JButton("-");
JButton button_cheng=new JButton("*");
JButton button_chu=new JButton("/");
JButton button_dy=new JButton("=");
public static void main(String[] args)
{
calculator calculator=new calculator();
}
calculator()
{
jg_TextField.setHorizontalAlignment(JTextField.RIGHT );//文本框 右对齐
JPanel pan=new JPanel();
pan.setLayout(new GridLayout(4,4,5,5));//四行四列 边距为5像素
pan.add(button7);
pan.add(button8);
pan.add(button9);
pan.add(button_chu);
pan.add(button4);
pan.add(button5);
pan.add(button6);
pan.add(button_cheng);
pan.add(button1);
pan.add(button2);
pan.add(button3);
pan.add(button_jian);
pan.add(button0);
pan.add(button_Dian);
pan.add(button_dy);
pan.add(button_jia);
pan.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));//pan对象的边距
JPanel pan2=new JPanel();
pan2.add(jg_TextField);
JPanel pan3=new JPanel(); //为什么要 多此一句呢? 因为我不会设置 按钮的大小
pan3.setLayout(new FlowLayout());
pan3.add(clear_Button);
//clear_Button.setSize(10,10);//设置清零按钮的大小 吗的 不好使 !!
frame.setLocation(300, 200); //主窗口 出现在位置
frame.setResizable(false); //不能调大小
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(pan2,BorderLayout.NORTH);
frame.getContentPane().add(pan,BorderLayout.CENTER);
frame.getContentPane().add(pan3,BorderLayout.SOUTH);
frame.pack();
frame.setVisible(true);
//以上是 控件 和 布局
//下面是事件处理 程 序
//--------------- 数 字 键 ----------------
class JianTing implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String ss=((JButton)e.getSource()).getText();
jicunqi=(JButton)e.getSource();
vt.add(jicunqi);
if (k1==1)
{
if(k3==1)
{
str1="";
k5=1;//还原开关k5状态
}
str1=str1+ss;
//k2=1;
k3=k3+1;
//System.out.println(str1);
jg_TextField.setText(str1);//显示
}
else if(k1==2)
{
if (k4==1)
{
str2="";
k5=1; //还原开关k5状态
}
str2=str2+ss;
//k2=2;
k4=k4+1;
///////////////测试////////////////
jg_TextField.setText(str2);
}
}
}

//--------符 号-----------
class JianTing_fh implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String ss2=((JButton)e.getSource()).getText();
jicunqi=(JButton)e.getSource();
vt.add(jicunqi);
if(k2==1)
{
k1=2;//开关 k1 为1时,向数1写 为2时,向数2写
k5=1;
fh=ss2;
k2=k2+1;//按符号键的次数
}
else
{
int a=vt.size();
JButton c=(JButton)vt.get(a-2); if(!(c.getText().equals("+"))&&!(c.getText().equals("-"))&&!(c.getText().equals("*"))&&!(c.getText().equals("/")))
{
yuns();
str1=jg;
k1=2;//开关 k1 为1时,向数1写 为2时,向数2写
k5=1;
k4=1;
fh=ss2;
} k2=k2+1;
}
}
}
//--------清除-------
class JianTing_clear implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
jicunqi=(JButton)e.getSource();
vt.add(jicunqi);
k5=1;
k2=1;
k1=1;
k3=1;
k4=1;
str1="0";
str2="0";
fh="";
jg="";
jg_TextField.setText(jg);
vt.clear();
}
}
//----------------等 于 ---------------------
class JianTing_dy implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
jicunqi=(JButton)e.getSource();
vt.add(jicunqi);
yuns();
k1=1; //还原开关k1状态
//str1=jg;
k2=1;
k3=1;//还原开关k3状态
k4=1; //还原开关k4状态
str1=jg; //为7+5=12 +5=17 这种计算做准备
}
}
//----------------小数点 ---------------------
class JianTing_xiaos implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
jicunqi=(JButton)e.getSource();
vt.add(jicunqi);
if(k5==1)
{
String ss2=((JButton)e.getSource()).getText();
if (k1==1)
{
if(k3==1)
{
str1="";
k5=1; //还原开关k5状态
}
str1=str1+ss2;
//k2=1;
k3=k3+1;
//System.out.println(str1);
jg_TextField.setText(str1);//显示
}
else if(k1==2)
{
if (k4==1)
{
str2="";
k5=1; //还原开关k5状态
}
str2=str2+ss2;
//k2=2;
k4=k4+1;
///////////////测试////////////////
jg_TextField.setText(str2);
}
}
k5=k5+1;
}
}
//注册 监听器
JianTing_dy jt_dy=new JianTing_dy();
JianTing jt= new JianTing();//临听数字键
JianTing_fh jt_fh= new JianTing_fh();//临 听符 号键
JianTing_clear jt_c=new JianTing_clear(); //清除键
JianTing_xiaos jt_xs=new JianTing_xiaos();// 小数点 键
button7.addActionListener(jt);
button8.addActionListener(jt);
button9.addActionListener(jt);
button_chu.addActionListener(jt_fh);
button4.addActionListener(jt);
button5.addActionListener(jt);
button6.addActionListener(jt);
button_cheng.addActionListener(jt_fh);
button1.addActionListener(jt);
button2.addActionListener(jt);
button3.addActionListener(jt);
button_jian.addActionListener(jt_fh);
button0.addActionListener(jt);
button_Dian.addActionListener(jt_xs);
button_dy.addActionListener(jt_dy);
button_jia.addActionListener(jt_fh);
clear_Button.addActionListener(jt_c);
//关闭事件处理程序
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
//---------------计 算------------------
public void yuns()
{
double a2,b2;//运算数1,2
String c=fh;// 运算符
double jg2=0 ;//结果
if (c.equals(""))
{
//System.out.println("请输入运算符");
jg_TextField.setText("请输入运算符");
}
else
{
System.out.println("str1:"+str1);//调试时 使 用
System.out.println("str2:"+str2);//调试时 使 用
System.out.println("运算符:"+fh);//调试时 使 用
if (str1.equals(".")) //字符串 "." 转换成double型数据时 会出错 所以手工转
str1="0.0";
if (str2.equals("."))
str2="0.0";
a2=Double.valueOf(str1).doubleValue();
b2=Double.valueOf(str2).doubleValue();
System.out.println("double型的a2:"+a2); //调试时 使 用
System.out.println("double型的b2:"+b2); //调试时 使 用
if (c.equals("+"))
{
jg2=a2+b2;
}
if (c.equals("-"))
{
jg2=a2-b2;
}
if (c.equals("*"))
{
jg2=a2*b2;
}
if (c.equals("/"))
{
if(b2==0)
{
jg2=0;//0000000000000 by 0 cu!
}
else
{
jg2=a2/b2;
}
}
System.out.println("double型a2"+fh+"b2结果:"+jg2);
System.out.println();
jg=((new Double(jg2)).toString());
jg_TextField.setText(jg);
}
}
}

Ⅵ 用Java设计科学计算器界面 能不能把你做的那个源代码发给我

package mypackage;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Counter implements ActionListener{
JRadioButton jr1;JRadioButton jr2;JRadioButton jr3;
JButton jbu1;JButton jbu2;JButton jbu3;JButton jbu4;
JButton jbu5;JButton jbu6;JButton jbu7;JButton jbu8;
JButton jbu9;JButton jbu10;JButton jbu11;JButton jbu12;
JButton jbu13;JButton jbu14;JButton jbu15;JButton jbu16;
JFrame fr;
Counter(){
fr=new JFrame("计算器");
}
public void myCounter(JFrame fr){
//获取内容窗口
Container ctpn = fr.getContentPane();
//设置布局管理器为边框布局管理器
ctpn.setLayout(new BorderLayout());
//标签
JPanel panel1=new JPanel();
panel1.setBorder(BorderFactory.createEtchedBorder());
JTextField tfield = new JTextField("",50);
panel1.add(tfield);
ctpn.add(panel1,BorderLayout.NORTH);
//单选按钮
JPanel panel2=new JPanel(new GridLayout(1,2,10,0));
fr.add(panel2,BorderLayout.CENTER);
panel2.setBorder(BorderFactory.createEtchedBorder());
JPanel panel6=new JPanel();
panel2.add(panel6);
panel6.setBorder(BorderFactory.createEtchedBorder());
panel6.setLayout(new BorderLayout());
JPanel panel3=new JPanel(new GridLayout(1,3));
jr1=new JRadioButton("十进制",true);
jr2=new JRadioButton("八进制");
jr3=new JRadioButton("二进制");
jr1.addActionListener(this);
jr2.addActionListener(this);
jr3.addActionListener(this);
panel3.add(jr3);
panel3.add(jr2);
panel3.add(jr1);
ButtonGroup bg = new ButtonGroup();
bg.add(jr1);
bg.add(jr2);
bg.add(jr3);
panel6.add(panel3,BorderLayout.NORTH);
panel6.setSize(50, 50);
JPanel panel5=new JPanel(new GridLayout(4,4,20,15));
JButton jb1= new JButton("Sin");
JButton jb2= new JButton("And");
JButton jb3= new JButton("(");
JButton jb4= new JButton(")");
JButton jb5= new JButton("Cos");
JButton jb6= new JButton("Or");
JButton jb7= new JButton("Exp");
JButton jb8= new JButton("Ln");
JButton jb9= new JButton("tan");
JButton jb10= new JButton("Xor");
JButton jb11= new JButton("x^y");
JButton jb12= new JButton("log");
JButton jb13= new JButton("e");
JButton jb14= new JButton("Not");
JButton jb15= new JButton("x^3");
JButton jb16= new JButton("n!");
panel5.add(jb1);panel5.add(jb2);panel5.add(jb3);panel5.add(jb4);panel5.add(jb5);
panel5.add(jb6);panel5.add(jb7);panel5.add(jb8);panel5.add(jb9);panel5.add(jb10);
panel5.add(jb11);panel5.add(jb12);panel5.add(jb13);panel5.add(jb14);panel5.add(jb15);
panel5.add(jb16);
panel6.add(panel5,BorderLayout.CENTER);
JPanel panel7=new JPanel();
panel2.add(panel7);
panel7.setBorder(BorderFactory.createEtchedBorder());
panel7.setLayout(new BorderLayout());
JPanel panel4=new JPanel(new GridLayout(1,2));
JCheckBox c1 = new JCheckBox("Inv");
JCheckBox c2 = new JCheckBox("Hyp");
panel4.add(c1);
panel4.add(c2);
panel7.add(panel4,BorderLayout.NORTH);
JPanel panel8=new JPanel(new GridLayout(4,4,20,15));
jbu1= new JButton("0");
jbu2= new JButton("1");
jbu3= new JButton("2");
jbu4= new JButton("3");
jbu5= new JButton("4");
jbu6= new JButton("5");
jbu7= new JButton("6");
jbu8= new JButton("7");
jbu9= new JButton("8");
jbu10= new JButton("9");
jbu11= new JButton("+");
jbu12= new JButton(".");
jbu13= new JButton("*");
jbu14= new JButton("/");
jbu15= new JButton("C");
jbu16= new JButton("=");
panel8.add(jbu1);panel8.add(jbu2);panel8.add(jbu3);panel8.add(jbu4);panel8.add(jbu5);
panel8.add(jbu6);panel8.add(jbu7);panel8.add(jbu8);panel8.add(jbu9);panel8.add(jbu10);
panel8.add(jbu11);panel8.add(jbu12);panel8.add(jbu13);panel8.add(jbu14);panel8.add(jbu15);
panel8.add(jbu16);
panel7.add(panel8,BorderLayout.CENTER);
fr.setSize(600,300);
fr.setLocation(100, 100);
fr.setResizable(false);
fr.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
JRadioButton jr=(JRadioButton)e.getSource();
if(jr==jr1)
{
jbu1.setEnabled(true);jbu2.setEnabled(true);
jbu3.setEnabled(true);jbu4.setEnabled(true);
jbu5.setEnabled(true);jbu6.setEnabled(true);
jbu7.setEnabled(true);jbu8.setEnabled(true);
jbu9.setEnabled(true);jbu10.setEnabled(true);
}
if(jr==jr2)
{
jbu1.setEnabled(true);jbu2.setEnabled(true);
jbu3.setEnabled(true);jbu4.setEnabled(true);
jbu5.setEnabled(true);jbu6.setEnabled(true);
jbu7.setEnabled(true);jbu8.setEnabled(true);
jbu9.setEnabled(false);
jbu10.setEnabled(false);
}
if(jr==jr3)
{
jbu3.setEnabled(false);jbu4.setEnabled(false);
jbu5.setEnabled(false);jbu6.setEnabled(false);
jbu7.setEnabled(false);jbu8.setEnabled(false);
jbu9.setEnabled(false);jbu10.setEnabled(false);
}
}
public static void main(String[] args){
Counter co=new Counter();
JFrame fr=new JFrame("计算器");
co.myCounter(fr);
}
}

Ⅶ 急求C语言编译的小游戏(如扫雷),附带源代码和注释。

扫雷游戏(c语言版)
已经编译运行确认了:

#include <graphics.h>
#include <stdlib.h>
#include <dos.h>
#define LEFTPRESS 0xff01
#define LEFTCLICK 0xff10
#define LEFTDRAG 0xff19
#define MOUSEMOVE 0xff08
struct
{
int num;/*格子当前处于什么状态,1有雷,0已经显示过数字或者空白格子*/
int roundnum;/*统计格子周围有多少雷*/
int flag;/*右键按下显示红旗的标志,0没有红旗标志,1有红旗标志*/
}Mine[10][10];
int gameAGAIN=0;/*是否重来的变量*/
int gamePLAY=0;/*是否是第一次玩游戏的标志*/
int mineNUM;/*统计处理过的格子数*/
char randmineNUM[3];/*显示数字的字符串*/
int Keystate;
int MouseExist;
int MouseButton;
int MouseX;
int MouseY;
void Init(void);/*图形驱动*/
void MouseOn(void);/*鼠标光标显示*/
void MouseOff(void);/*鼠标光标隐藏*/
void MouseSetXY(int,int);/*设置当前位置*/
int LeftPress(void);/*左键按下*/
int RightPress(void);/*鼠标右键按下*/
void MouseGetXY(void);/*得到当前位置*/
void Control(void);/*游戏开始,重新,关闭*/
void GameBegain(void);/*游戏开始画面*/
void DrawSmile(void);/*画笑脸*/
void DrawRedflag(int,int);/*显示红旗*/
void DrawEmpty(int,int,int,int);/*两种空格子的显示*/
void GameOver(void);/*游戏结束*/
void GameWin(void);/*显示胜利*/
int MineStatistics(int,int);/*统计每个格子周围的雷数*/
int ShowWhite(int,int);/*显示无雷区的空白部分*/
void GamePlay(void);/*游戏过程*/
void Close(void);/*图形关闭*/
void main(void)
{
Init();
Control();
Close();
}
void Init(void)/*图形开始*/
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc");
}
void Close(void)/*图形关闭*/
{
closegraph();
}
void MouseOn(void)/*鼠标光标显示*/
{
_AX=0x01;
geninterrupt(0x33);
}
void MouseOff(void)/*鼠标光标隐藏*/
{
_AX=0x02;
geninterrupt(0x33);
}
void MouseSetXY(int x,int y)/*设置当前位置*/
{
_CX=x;
_DX=y;
_AX=0x04;
geninterrupt(0x33);
}
int LeftPress(void)/*鼠标左键按下*/
{
_AX=0x03;
geninterrupt(0x33);
return(_BX&1);
}
int RightPress(void)/*鼠标右键按下*/
{
_AX=0x03;
geninterrupt(0x33);
return(_BX&2);
}
void MouseGetXY(void)/*得到当前位置*/
{
_AX=0x03;
geninterrupt(0x33);
MouseX=_CX;
MouseY=_DX;
}
void Control(void)/*游戏开始,重新,关闭*/
{
int gameFLAG=1;/*游戏失败后判断是否重新开始的标志*/
while(1)
{
if(gameFLAG)/*游戏失败后没判断出重新开始或者退出游戏的话就继续判断*/
{
GameBegain(); /*游戏初始画面*/
GamePlay();/*具体游戏*/
if(gameAGAIN==1)/*游戏中重新开始*/
{
gameAGAIN=0;
continue;
}
}
MouseOn();
gameFLAG=0;
if(LeftPress())/*判断是否重新开始*/
{
MouseGetXY();
if(MouseX>280&&MouseX<300&&MouseY>65&&MouseY<85)
{
gameFLAG=1;
continue;
}
}
if(kbhit())/*判断是否按键退出*/
break;
}
MouseOff();
}
void DrawSmile(void)/*画笑脸*/
{
setfillstyle(SOLID_FILL,YELLOW);
fillellipse(290,75,10,10);
setcolor(YELLOW);
setfillstyle(SOLID_FILL,BLACK);/*眼睛*/
fillellipse(285,75,2,2);
fillellipse(295,75,2,2);
setcolor(BLACK);/*嘴巴*/
bar(287,80,293,81);
}
void DrawRedflag(int i,int j)/*显示红旗*/
{
setcolor(7);
setfillstyle(SOLID_FILL,RED);
bar(198+j*20,95+i*20,198+j*20+5,95+i*20+5);
setcolor(BLACK);
line(198+j*20,95+i*20,198+j*20,95+i*20+10);
}
void DrawEmpty(int i,int j,int mode,int color)/*两种空格子的显示*/
{
setcolor(color);
setfillstyle(SOLID_FILL,color);
if(mode==0)/*没有单击过的大格子*/
bar(200+j*20-8,100+i*20-8,200+j*20+8,100+i*20+8);
else
if(mode==1)/*单击过后显示空白的小格子*/
bar(200+j*20-7,100+i*20-7,200+j*20+7,100+i*20+7);
}
void GameBegain(void)/*游戏开始画面*/
{
int i,j;
cleardevice();
if(gamePLAY!=1)
{
MouseSetXY(290,70); /*鼠标一开始的位置,并作为它的初始坐标*/
MouseX=290;
MouseY=70;
}
gamePLAY=1;/*下次按重新开始的话鼠标不重新初始化*/
mineNUM=0;
setfillstyle(SOLID_FILL,7);
bar(190,60,390,290);
for(i=0;i<10;i++)/*画格子*/
for(j=0;j<10;j++)
DrawEmpty(i,j,0,8);
setcolor(7);
DrawSmile();/*画脸*/
randomize();__page_break__
for(i=0;i<10;i++)/*100个格子随机赋值有没有地雷*/
for(j=0;j<10;j++)
{
Mine[i][j].num=random(8);/*如果随机数的结果是1表示这个格子有地雷*/
if(Mine[i][j].num==1)
mineNUM++;/*现有雷数加1*/
else
Mine[i][j].num=2;
Mine[i][j].flag=0;/*表示没红旗标志*/
}
sprintf(randmineNUM,"%d",mineNUM); /*显示这次总共有多少雷数*/
setcolor(1);
settextstyle(0,0,2);
outtextxy(210,70,randmineNUM);
mineNUM=100-mineNUM;/*变量取空白格数量*/
MouseOn();
}
void GameOver(void)/*游戏结束画面*/
{
int i,j;
setcolor(0);
for(i=0;i<10;i++)
for(j=0;j<10;j++)
if(Mine[i][j].num==1)/*显示所有的地雷*/
{
DrawEmpty(i,j,0,RED);
setfillstyle(SOLID_FILL,BLACK);
fillellipse(200+j*20,100+i*20,7,7);
}
}
void GameWin(void)/*显示胜利*/
{
setcolor(11);
settextstyle(0,0,2);
outtextxy(230,30,"YOU WIN!");
}
int MineStatistics(int i,int j)/*统计每个格子周围的雷数*/
{
int nNUM=0;
if(i==0&&j==0)/*左上角格子的统计*/
{
if(Mine[0][1].num==1)
nNUM++;
if(Mine[1][0].num==1)
nNUM++;
if(Mine[1][1].num==1)
nNUM++;
}
else
if(i==0&&j==9)/*右上角格子的统计*/
{
if(Mine[0][8].num==1)
nNUM++;
if(Mine[1][9].num==1)
nNUM++;
if(Mine[1][8].num==1)
nNUM++;
}
else
if(i==9&&j==0)/*左下角格子的统计*/
{
if(Mine[8][0].num==1)
nNUM++;
if(Mine[9][1].num==1)
nNUM++;
if(Mine[8][1].num==1)
nNUM++;
}
else
if(i==9&&j==9)/*右下角格子的统计*/
{
if(Mine[9][8].num==1)
nNUM++;
if(Mine[8][9].num==1)
nNUM++;
if(Mine[8][8].num==1)
nNUM++;
}
else if(j==0)/*左边第一列格子的统计*/
{
if(Mine[i][j+1].num==1)
nNUM++;
if(Mine[i+1][j].num==1)
nNUM++;
if(Mine[i-1][j].num==1)
nNUM++;
if(Mine[i-1][j+1].num==1)
nNUM++;
if(Mine[i+1][j+1].num==1)
nNUM++;
}
else if(j==9)/*右边第一列格子的统计*/
{
if(Mine[i][j-1].num==1)
nNUM++;
if(Mine[i+1][j].num==1)
nNUM++;
if(Mine[i-1][j].num==1)
nNUM++;
if(Mine[i-1][j-1].num==1)
nNUM++;
if(Mine[i+1][j-1].num==1)
nNUM++;
}
else if(i==0)/*第一行格子的统计*/
{
if(Mine[i+1][j].num==1)
nNUM++;
if(Mine[i][j-1].num==1)
nNUM++;
if(Mine[i][j+1].num==1)
nNUM++;
if(Mine[i+1][j-1].num==1)
nNUM++;
if(Mine[i+1][j+1].num==1)
nNUM++;
}
else if(i==9)/*最后一行格子的统计*/
{
if(Mine[i-1][j].num==1)
nNUM++;
if(Mine[i][j-1].num==1)
nNUM++;
if(Mine[i][j+1].num==1)
nNUM++;
if(Mine[i-1][j-1].num==1)
nNUM++;
if(Mine[i-1][j+1].num==1)
nNUM++;
}
else/*普通格子的统计*/
{
if(Mine[i-1][j].num==1)
nNUM++;
if(Mine[i-1][j+1].num==1)
nNUM++;
if(Mine[i][j+1].num==1)
nNUM++;
if(Mine[i+1][j+1].num==1)
nNUM++;
if(Mine[i+1][j].num==1)
nNUM++;
if(Mine[i+1][j-1].num==1)
nNUM++;
if(Mine[i][j-1].num==1)
nNUM++;
if(Mine[i-1][j-1].num==1)
nNUM++;
}__page_break__
return(nNUM);/*把格子周围一共有多少雷数的统计结果返回*/
}
int ShowWhite(int i,int j)/*显示无雷区的空白部分*/
{
if(Mine[i][j].flag==1||Mine[i][j].num==0)/*如果有红旗或该格处理过就不对该格进行任何判断*/
return;
mineNUM--;/*显示过数字或者空格的格子就表示多处理了一个格子,当所有格子都处理过了表示胜利*/
if(Mine[i][j].roundnum==0&&Mine[i][j].num!=1)/*显示空格*/
{
DrawEmpty(i,j,1,7);
Mine[i][j].num=0;
}
else
if(Mine[i][j].roundnum!=0)/*输出雷数*/
{
DrawEmpty(i,j,0,8);
sprintf(randmineNUM,"%d",Mine[i][j].roundnum);
setcolor(RED);
outtextxy(195+j*20,95+i*20,randmineNUM);
Mine[i][j].num=0;/*已经输出雷数的格子用0表示已经用过这个格子*/
return ;
}
/*8个方向递归显示所有的空白格子*/
if(i!=0&&Mine[i-1][j].num!=1)
ShowWhite(i-1,j);
if(i!=0&&j!=9&&Mine[i-1][j+1].num!=1)
ShowWhite(i-1,j+1);
if(j!=9&&Mine[i][j+1].num!=1)
ShowWhite(i,j+1);
if(j!=9&&i!=9&&Mine[i+1][j+1].num!=1)
ShowWhite(i+1,j+1);
if(i!=9&&Mine[i+1][j].num!=1)
ShowWhite(i+1,j);
if(i!=9&&j!=0&&Mine[i+1][j-1].num!=1)
ShowWhite(i+1,j-1);
if(j!=0&&Mine[i][j-1].num!=1)
ShowWhite(i,j-1);
if(i!=0&&j!=0&&Mine[i-1][j-1].num!=1)
ShowWhite(i-1,j-1);
}
void GamePlay(void)/*游戏过程*/
{
int i,j,Num;/*Num用来接收统计函数返回一个格子周围有多少地雷*/
for(i=0;i<10;i++)
for(j=0;j<10;j++)
Mine[i][j].roundnum=MineStatistics(i,j);/*统计每个格子周围有多少地雷*/
while(!kbhit())
{
if(LeftPress())/*鼠标左键盘按下*/
{
MouseGetXY();
if(MouseX>280&&MouseX<300&&MouseY>65&&MouseY<85)/*重新来*/
{
MouseOff();
gameAGAIN=1;
break;
}
if(MouseX>190&&MouseX<390&&MouseY>90&&MouseY<290)/*当前鼠标位置在格子范围内*/
{
j=(MouseX-190)/20;/*x坐标*/
i=(MouseY-90)/20;/*y坐标*/
if(Mine[i][j].flag==1)/*如果格子有红旗则左键无效*/
continue;
if(Mine[i][j].num!=0)/*如果格子没有处理过*/
{
if(Mine[i][j].num==1)/*鼠标按下的格子是地雷*/
{
MouseOff();
GameOver();/*游戏失败*/
break;
}
else/*鼠标按下的格子不是地雷*/
{
MouseOff();
Num=MineStatistics(i,j);
if(Num==0)/*周围没地雷就用递归算法来显示空白格子*/
ShowWhite(i,j);
else/*按下格子周围有地雷*/
{
sprintf(randmineNUM,"%d",Num);/*输出当前格子周围的雷数*/
setcolor(RED);
outtextxy(195+j*20,95+i*20,randmineNUM);
mineNUM--;
}
MouseOn();
Mine[i][j].num=0;/*点过的格子周围雷数的数字变为0表示这个格子已经用过*/
if(mineNUM<1)/*胜利了*/
{
GameWin();
break;
}
}
}
}
}
if(RightPress())/*鼠标右键键盘按下*/
{
MouseGetXY();
if(MouseX>190&&MouseX<390&&MouseY>90&&MouseY<290)/*当前鼠标位置在格子范围内*/
{
j=(MouseX-190)/20;/*x坐标*/
i=(MouseY-90)/20;/*y坐标*/
MouseOff();
if(Mine[i][j].flag==0&&Mine[i][j].num!=0)/*本来没红旗现在显示红旗*/
{
DrawRedflag(i,j);
Mine[i][j].flag=1;
}
else
if(Mine[i][j].flag==1)/*有红旗标志再按右键就红旗消失*/
{
DrawEmpty(i,j,0,8);
Mine[i][j].flag=0;
}
}
MouseOn();
sleep(1);
}
}
}

Ⅷ 基于matlab运动模糊图像处理的源代码

等一会的,我来帮你

华东师范大学???

tuxianghuanyuan('3.jpg', 80, 8, 0.02);


function tuxianghuanyuan(im, a, b, NSPR)

i = imread(im);

f = im2double(i);

PSF = fspecial('motion', a, b);

frest1 = deconvwnr(f, PSF, NSPR);

subplot(221),imshow(f); title('原图像');

subplot(222),imshow(frest1); title('维纳滤波处理后图像');

end

阅读全文

与tanlas源码相关的资料

热点内容
组织胚胎学pdf 浏览:844
linux查看发包 浏览:496
加密货币交易所暴利时代 浏览:824
歌词滚动效果android 浏览:14
程序员一天的六场战斗 浏览:797
自制压缩泵的做法 浏览:622
androidstring变量 浏览:247
数学乘法速算法 浏览:986
压缩包制作后照片顺序怎么改 浏览:680
fibonacci数列算法 浏览:775
产品经理要和程序员吵架吗 浏览:252
grub2命令行 浏览:618
无法获取加密卡信息 浏览:774
云服务器网卡充值 浏览:509
编程就是软件 浏览:49
服务器如何添加权限 浏览:437
引用指针编程 浏览:851
手机加密日记本苹果版下载 浏览:64
命令行括号 浏览:176
java程序升级 浏览:490