#include :iosrteam.h"
main()
{
int x,y,r1,r2;
cin>>x>>y;
if(s=0||y=o)
cout<<"input error"<<dedl;
else
{
if(x>y)
r1=x/y;
r2=x%y;
else
r1=y/x;
r2=y%x;
}
cout<<"商="<<r1<<"余数="<<r2<<endl;
}
#include :iosrteam.h"
main()
{
int x,y,r1,r2;
cin>>x>>y;
if(s=0||y=o)
cout<<"input error"<<dedl;
else
{
if(x>y)
r1=x/y;
r2=x%y;
else
r1=y/x;
r2=y%x;
}
cout<<"商="<<r1<<"余数="<<r2<<endl;
}
你好. 程序中有些小问题. 已经帮你改过来了.
有问题还请追问.
#include "iostream.h" //注意头文件名和" "
main()
{
int x,y,r1,r2;
cin>>x>>y;
if(x==0||y==0) //p判断的是x和y. 并且==是判断. =是赋值.
cout<<"input error"<<endl; //endl;
else
{
if(x>y) //if语句中执行两条语句. 所以要加花括号{}
{
r1=x/y;
r2=x%y;
}
else //else语句同上, 加上{}
{
r1=y/x;
r2=y%x;
}
}
cout<<"商="<<r1<<"余数="<<r2<<endl;
}
#include <iostream.h>
void main() { int x,y,r1,r2; cin>>x>>y; if(x==0 || y==0) cout<<"input error"<<endl; else { if(x>y) { r1=x/y; r2=x%y; } else { r1=y/x; r2=y%x; } } cout<<"商="<<r1<<"余数="<<r2<<endl; }
#include <iosrteam>
using namespace std;
int main()
{
int x,y,r1,r2;
cin>>x>>y;
if(s==0||y==o)
cout<<"input error"<<endl;
else
{
if(x>y)
{
r1=x/y;
r2=x%y;
}
else
{
r1=y/x;
r2=y%x;
}
}
cout<<"商="<<r1<<"余数="<<r2<<endl;
return 0;
}