求做 C语言程序设计 习题
帮你做第一题吧,第二题没时间。 sorry#include <iostream>using namespace std;void maxnum(float *,float *,float *);int main(){ float*p1,*p2,*p3; p1=new (float); p2=new (float); p3=new (float); cout<<"p1="; cin>>*p1; cout<<endl; cout<<"p2="; cin>>*p2; cout<<endl; cout<&l...全部
帮你做第一题吧,第二题没时间。
sorry#include <iostream>using namespace std;void maxnum(float *,float *,float *);int main(){ float*p1,*p2,*p3; p1=new (float); p2=new (float); p3=new (float); cout<<"p1="; cin>>*p1; cout<<endl; cout<<"p2="; cin>>*p2; cout<<endl; cout<<"p3="; cin>>*p3; cout<<endl; maxnum(p1,p2,p3); cout<<"p1="<<*p1<<endl; cout<<"p2="<<*p2<<endl; cout<<"p3="<<*p3<<endl; delete(p1); delete(p2); delete(p3); return 0;} void maxnum(float *m1,float *m2,float *m3){ float temp; if(*m1<*m2) {temp=*m1; *m1=*m2; *m2=temp; } if(*m1<*m3) {temp=*m1; *m1=*m3; *m3=temp; } if(*m2<*m3) {temp=*m2; *m2=*m3; *m3=temp; } }。收起