//取余数(%) #include<iostream> using namespace std; int main(){ int apple=60; //苹果 int people=7; //人数 int apple_remain; //平分后还剩几个苹果 if(people==0) cout<<"错误!"<<endl; else{ apple_remain=apple%people; //取余 cout<<"平均分配后还剩"<<apple_remain<<"个苹果"<<endl; } return 0; }