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()
{

}

}

//只能幫你到這里了,我自己還得忙,不好意思了,看錯題目了