[ create a new paste ] login | about

Link: http://codepad.org/0elRHz2j    [ raw code | output | fork ]

C++, pasted on May 9:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;

int main(){
    int p1;
    int p2;
    const char s1[] = "375";
    const char s2[] = "-5";
    if( sscanf(s1, "%d", &p1) )
    if( sscanf(s2, "%d", &p2) )
    {
        if( p2 == 0 )
            cout<<"DIV ON ZERO"<<endl;
        else
            cout<<p1<<" / "<<p2<<" = "<<p1/p2<<endl;
    }
    return 0;
}


Output:
1
375 / -5 = -75


Create a new paste based on this one


Comments: