Check that an inputted number is not zero

C++

Public Domain

Check that an inputted number is not zero

Download (right click, save as, rename as appropriate)

Embed

1
2
3
4
5
6
7
8
    GetOperation(operation);       // Calls a function to get an operation in char form  
    if(operation == '/')
    {
       do
         GetNum(num2); // if we're dividing, need to check if this number is 0
       while(num2 == 0)
         cout << "Dividing by zero is not legal." << endl;  //compiler error says "';' expected before 'cout'"
    }