Advertisement
idsystems

CPP_Practica30 - ISBN

Jan 30th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. // Program: isbn.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.    int d1, d2, d3, d4, d5, d6, d7, d8, d9, d10;
  12.  
  13.    cout << "Digito de control ISBN" << endl;
  14.    cout << "======================" << endl;
  15.  
  16.    cout << "Introduzca el ISBN = ";
  17.    cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6 >> d7 >> d8 >> d9;
  18.  
  19.    d10= 1*d1 + 2*d2 + 3*d3 + 4*d4 + 5*d5 + 6*d6 + 7*d7 + 8*d8 + 9*d9;
  20.    d10 %= 11;
  21.  
  22.    if( d10==10 )
  23.    {
  24.       cout << "El digito de control es X" << endl;
  25.    }
  26.    else
  27.    {
  28.       cout << "El digito de control es " << d10 << endl;
  29.    }
  30.  
  31.    return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement