我同学写的代码 错误了 我不太懂指针 求哪个大神指教
问题补充:
#include<iostream.h>swap( int* x,int*y);void main(){ int *a, *b, *c; a=new int; b=new int; c=new int; cout<<"input 3 number : "; cin>>*a>>*b>>*c; if(*a > *b) if(*b > *c)swap(a, b); swap(b, c); if(*a > *b) swap(a, b); cout<< *a<<*b<< *c; delete a; delete b; delete c;}
void swap( int* x, int *y){ int d = *x; *x = *y; *y = d;
最佳答案
改前三行为
#include<iostream>
using namespace std;
void swap( int* x,int*y);
int main()
并在最后加一个
}
就可以编译运行了
(你的教材太古老了,现在的编译器不支持iostream.h了)
最佳答案由网友 whoami1978 提供
其他回答
暂无其它回答!