c语言,添加代码,把以下程序补全。

int (*p1)(int a1,int b1),int (*p2)(int a2,int b2)

java 补全代码

楼主,依题意,完整的程序如下:
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Exam2 extends Thread implements ActionListener
{
//声明界面元素
private JFrame timeFrame;
private JButton startButton;
private JButton stopButton;
private JButton resetButton;
private JLabel timeLabel;

//定义变量存储时、分、秒
int hour = 0;
int minute = 0;
int second = 0;

//声明线程对象
Thread myThread;

public Exam2()
{
timeFrame = new JFrame("计时器");
startButton = new JButton("开始");
stopButton = new JButton("停止");
resetButton = new JButton("重置");
timeLabel = new JLabel("00:00:00");

timeFrame.setLayout(new FlowLayout());
timeFrame.setBounds((Toolkit.getDefaultToolkit().getScreenSize().width - 300)/2,
(Toolkit.getDefaultToolkit().getScreenSize().height - 200)/2, 300, 200);
timeFrame.add(timeLabel);
timeFrame.add(startButton);
timeFrame.add(stopButton);
timeFrame.add(resetButton);
timeFrame.setVisible(true);
timeFrame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
startButton.addActionListener(this);
stopButton.addActionListener(this);
resetButton.addActionListener(this);

myThread = this;
}

public void actionPerformed(ActionEvent e)
{

if(e.getSource() == this.startButton)
{
System.out.println("计时开始...");
if(this.start)
{
this.myThread.start();
}
else
{
this.start = true;
}
}
if(e.getSource() == this.stopButton)
{
System.out.println("计时停止...");
this.start = false;
}

if(e.getSource() == this.resetButton)
{
hour = 0;
minute = 0;
second = 0;
}

}
volatile boolean start = true;

@Override
public void run()
{
while(true)
{
if(this.start)
{
second++;
try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{
e.printStackTrace();
}

if(second >= 60)
{
second = 0;
minute++;
}

if(minute >= 60)
{
minute = 0;
hour++;
}
showTime();
}
}
}
private void showTime()
{
String strTime = "";
if(hour < 10)
{
strTime += "0"+hour + ":";
}
else
{
strTime += hour + ":";
}
if(minute < 10)
{
strTime += "0"+minute + ":";
}
else
{
strTime += minute + ":";
}
if(second < 10)
{
strTime += "0"+second;
}
else
{
strTime += second;
}
this.timeLabel.setText(strTime);
}
public static void main(String[] args)
{
new Exam2();
}
}
有问题欢迎提问,满意请点赞,谢谢!

Ⅲ 求补全程序

#include <stdio.h>
void main() {
int a[11]={19,17,15,13,11,9,7,5,3,1},k,i;
scanf("%d",&k);
for (i=9; i>=0; i--)
{
if (a[i]<k)
{
a[i+1]=a[i];
if (i==0)
a[i]=k ;
}
else
{
a[i+1]=k;
break;
}
}
for (i=0; i<11; i++)
printf("%d ",a[i]);
}

Ⅳ C语言 补全程序

Ⅳ C语言求救=。=帮忙补全程序

程序1代码:

/*
功能:产生20个[30,120]上的随机整数放入二维数组a[5][4]中,求每行元素的和
*/

#include<stdio.h>
voidwwjt();

voidrow_sum(inta[5][4],intb[5])
{
inti=0,j=0,sum=0;
for(i=0;i<5;i++)
{
sum=0;
for(j=0;j<4;j++)
{
sum+=a[i][j];
}
b[i]=sum;
}
}

main()
{
voidrow_sum();
inta[5][4],b[5],i,j;

for(i=0;i<5;i++)
for(j=0;j<4;j++)
a[i][j]=rand()%(120-30+1)+30;

FILE*fp=fopen("in.dat","w");//将随机产生的数组写入到in.dat中,供wwjt()函数使用
for(i=0;i<5;i++)
{
for(j=0;j<4;j++)
{
printf("%5d",a[i][j]);
fprintf(fp,"%5d",a[i][j]);
}
printf(" ");
fprintf(fp," ");
}
fclose(fp);

row_sum(a,b);
for(i=0;i<5;i++)
printf("%6d",b[i]);
printf(" ");
wwjt();
}

voidwwjt()
{
FILE*IN,*OUT;
intm,n;
inti[5][4];
into[5];
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("ReadFILEError");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("WriteFILEError");
}

for(m=0;m<5;m++)
for(n=0;n<4;n++)
fscanf(IN,"%d",&i[m][n]);

row_sum(i,o);
for(n=0;n<5;n++)
fprintf(OUT,"%d ",o[n]);

fclose(IN);
fclose(OUT);
}

运行结果:

108 104 67 112
31 96 68 46
31 89 32 98
43 34 120 44
117 66 53 67
391 241 250 241 303


程序2代码:

/*
功能:实现两个整数的交换。
例如:给a和b分别输入:60和65,输出为:a=65b=60
*/

#include<stdio.h>
voidwwjt();

voidfun(int*a,int*b)
{
inttmp;
tmp=*a;
*a=*b;
*b=tmp;
}

main()
{
inta,b;
printf("Entera,b:");
scanf("%d%d",&a,&b);
fun(&a,&b);
printf("a=%db=%d ",a,b);
wwjt();
}

voidwwjt()
{
FILE*IN,*OUT;
inta,b,n;
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("ReadFILEError");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("WriteFILEError");
}
for(n=0;n<5;n++)
{
fscanf(IN,"%d%d",&a,&b);
fun(&a,&b);
fprintf(OUT,"a=%db=%d ",a,b);
}
fclose(IN);
fclose(OUT);
}

运行结果:

Enter a,b: 60 65
a=65 b=60


程序3代码:

/*
题目:编写函数,要求输入一行字符,统计其中字母、数字、空格及其他字符的个数
(用指针作为函数参数)。
*/

#include<stdio.h>
#defineN100

voidfun(charstr[],int*p1,int*p2,int*p3)
{
inti;
i=0;
while(str[i]!='')
{
if(str[i]>='a'&&str[i]<='z')
(*p1)++;
elseif(str[i]>='A'&&str[i]<='Z')
(*p2)++;
elseif(str[i]>='0'&&str[i]<='9')
(*p3)++;
i++;
}
}

voidmain()
{
charstr[N];
inta=0,b=0,c=0;
gets(str);
fun(str,&a,&b,&c);
printf("小写字母个数为a=%d,大写字母个数为b=%d,数字个数为c=%d ",a,b,c);
}

运行结果:

BAIDU 123456
小写字母个数为a=6, 大写字母个数为b=5, 数字个数为c=6

Ⅵ 补全代码

#include<iostream>
usingnamespacestd;

voidmain()
{
charstr[20]="Ihaveadream!";

//请写出输出整个字符串的代码
cout<<str;

//请写出输出第五个字符的代码
cout<<str[4];

system("pause");
}
#include<iostream>
usingnamespacestd;

voidmain()
{
inta[10]={1,3,5,7,9},*p;

//请写出将数组a的地址赋给指针p的代码
p=a;

//请写出输出p+3所指向数据的代码
cout<<*(p+3);

system("pause");
}
求两数较小者的程序,请补全代码
#include<iostream>
usingnamespacestd;

intswap(intx,inty)
{
return(x<y)?x:y;
}

voidmain()
{
inta=5,b=10;
cout<<"较小数是:"<<swap(a,b)<<endl;

system("pause");
}

Ⅶ 补全完整以下程序代码 C# ______这些代表需要补全

class program
{
static void Main(string[] args)

int a,b,I;
__int__ relt=1,temp;
console.writeLine("请输入1个整数:");
a=int.parse(_console.ReadLine()___);
console.writeLine("请输入2个整数:");
b=int.pares(console.ReadLine());
if(a>b)
temp=b;
__if(a<b)_________
temp=a;
console.writeLine("最小公倍数为:");
for(i=temp; i<a*b; i++)
if(i%a=0__&&____i%b==0)
{
relt=i;
break;
}
console.writeLine(__relt___);
}
}

Ⅷ c语言补全程序

题的输出应该有问题,我数了一下2*2的应该有6种方法,你可以自己数一下。
#include "stdio.h"
int main(void)
{
int m,n;
scanf("%d%d",&m,&n);
long res1=1,res2=1,res3=1;
for(int i=2;i<=m+n;i++)
res1*=i;

for(int i=2;i<=m;i++)
res2*=i;

for(int i=2;i<=n;i++)
res3*=i;
printf("%d\n",res1/(res2*res3));
return 0;

}

Ⅸ C语言求救=。=在中间补全程序

1.for(i=0;i<N;i++)
{
for(j=0;j<N;j++)

if(i==j || i+j == N)

sum += a[i][j];

}
2.while(s1[i]!='\0')
i++;

while(s2[j]!='\0')
{
s1[i++]=s2[j];

j++;

}
3.for(i=0;i<N;i++)
{
for(j=0;j<=i;j++)

if(j ==0|| i == j)

a[i][j]=1;

else

a[i][j] = a[i-1][j] + a[i-1][j-1];

}
4.ch=a[0];
for(i=1;a[i]!='\0';i++)
{
a[i-1]=a[i];

}
a[i]=ch;

Ⅹ c++补全程序

class Rational

{

private:
intx;
inty;
public:
Rational(intv1=0,intv2=1)
{
x=v1,y=v2;
}
template<typenameT>
staticTAdd(constT&v1,constT&v2)
{
returnv1+v2;
}
staticTSub(constT&v1,constT&v2)
{
returnv1-v2;
}
staticTMul(constT&v1,constT&v2)
{
returnv1*v2;
}
staticTDiv(constT&v1,constT&v2)
{
returnv1/v2;
}
voidPrint()
{
printf("%d'/'%d",x,y);
}
voidPrintFloat()
{

}

}

//只能帮你到这里了,我自己还得忙,不好意思了,看错题目了