EXCHANGE.CPP
资源名称:C++100.rar [点击查看]
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:
Windows编程
开发平台:
Visual C++
- #include <stdio.h>
- #include <math.h>
- void EXCHANGE(int &NUM1,int &NUM2);
- int main(void)
- {
- int NUMBER1,NUMBER2;
- printf("Please input two integers : ");
- scanf("%d %d",&NUMBER1,&NUMBER2);
- printf("Before the exchange :n");
- printf("NUMBER1 = %d NUMBER2 = %dn",NUMBER1,NUMBER2);
- EXCHANGE(NUMBER1,NUMBER2);
- printf("After the exchange :n");
- printf("NUMBER1 = %d NUMBER2 = %dn",NUMBER1,NUMBER2);
- return 0;
- }
- void EXCHANGE(int &NUM1,int &NUM2)
- {
- int BUFFER;
- BUFFER=NUM1;
- NUM1=NUM2;
- NUM2=BUFFER;
- }