/*
*Copyright (c)2014,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:gcd.cpp
*作 者:惠睿
*完成日期:2014年12月8日
*版 本 号:v1.0
*
*问题描述:输入两个整数,调用函数ast,输出两数之和和两数之差。
*程序输出:输出两数之和和两数之差。
*/
#include <iostream>
using namespace std;
void ast(int x,int y,int *cp,int *dp)
{
*cp=x+y;
*dp=x-y;
}
int main()
{
int a,b,c,d;
cin>>a>>b;
ast(a,b,&c,&d);
cout<<c<<" "<<d<<endl;
return 0;
}
运行结果:
知识点总结:熟悉指针的基本操作。