Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     ifstream f; f.open("input.txt");
  10.     ofstream ff; ff.open("output.txt");
  11.     int a=0,b=0,c=0,d=0,q=0;
  12.     f>>a>>b>>c>>d;
  13.    
  14.     if(a>b){
  15.         swap(a,b);
  16.     }
  17.     if(c>d){
  18.         swap(c,d);
  19.     }
  20.    
  21.     for(int i=a;i<=b;i++){
  22.         for(int j=c;j<=d;j++){
  23.             if(i==j){
  24.                 q++;
  25.                
  26.             }
  27.         }
  28.     }
  29.     ff<<q;
  30.     ff.close();
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement