Hi. This program has a function that divides an unsigned arg by another unsigned arg. I want it to only keep outputting "I'm really upset" after the first time it outputs "I'm really upset". Right now it outputs as
5
0
I'm really upset
6
Press any key to continue . . .
I want it to output like this
5
0
I'm really upset
I'm really upset
Press any key to continue . . .
#include<iostream>
using namespace std;
void divide(unsigned a, unsigned b);
int main(){
divide(100,20);
divide(3, 4);
divide(12, 0);
divide(18,3);
system("pause");
}
void divide(unsigned a, unsigned b){
if(b==0)
cout << "I'm really upset" << endl;
else
cout << a / b << endl;
}