全文预览

c 实验7

上传者:你的雨天 |  格式:docx  |  页数:16 |  大小:237KB

文档介绍
dl;?return(m+n);}intminus(intm,intn){?intresult;?cin>>result;?if(m-n==result)?{ cout<<"计算正确!"<<endl; return(m-n);?}?else cout<<"计算错误!"<<m<<"-"<<n<<"="<<m-n<<""<<endl;?return(m-n);}intmul(intm,intn){?intresult;?cin>>result;?if(m*n==result)?{ cout<<"计算正确!"<<endl; return(m*n);?}?else cout<<"计算错误!"<<m<<"*"<<n<<"="<<m*n<<""<<endl;?return(m*n);}3.#include<iostream>usingnamespacestd;doublezhang(doublex,doubley);voidmain(){?cout<<"2017114499张恒"<<endl;?doublea,b;?cout<<"求a的b次方与b的a次方的和,请输入a、b:";?cin>>a>>b;?cout<<""<<a<<"的"<<b<<"次方为:"<<zhang(a,b)<<""<<endl;?cout<<""<<b<<"的"<<a<<"次方为:"<<zhang(b,a)<<""<<endl;?cout<<""<<a<<"的"<<b<<"次方与"<<b<<"的"<<a<<"次方的和为:"<<zhang(a,b)+zhang(b,a)<<""<<endl;}doublezhang(doublex,doubley){?doublesum=1,i=1;?while(i<=y)?{ sum=sum*x; i=i+1;?}?return(sum);}4.#include<iostream>

收藏

分享

举报
下载此文档