diff options
author | Michael Abed <michaelabed@gmail.com> | 2012-02-12 15:09:28 -0500 |
---|---|---|
committer | Michael Abed <michaelabed@gmail.com> | 2012-02-12 15:09:28 -0500 |
commit | 85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb (patch) | |
tree | 161c0a39bfad57cfe1339c9a8a03da1aeb3c8666 /problem3.cpp | |
parent | cbca973f699f10d45b725e94ed3f49be9cf1f512 (diff) | |
download | ec327-lab1-85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb.tar.gz ec327-lab1-85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb.tar.bz2 ec327-lab1-85cdcd0e5c89f0c180b63fb0293b9b8f4322d3bb.zip |
move files
Diffstat (limited to 'problem3.cpp')
-rw-r--r-- | problem3.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/problem3.cpp b/problem3.cpp deleted file mode 100644 index 518ec0f..0000000 --- a/problem3.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -#include <iostream> - -using namespace std; - -int main() -{ - unsigned int n1, n2; - bool good; - do { - cout << "Enter two integers between 0 and 999999: "; - cin >> n1 >> n2; - good = n1 <= 999999 && n1 >= 0 && n2 <= 999999 && n2 >= 0; - if (!good) - cout << "The numbers must be between 0 and 999999" << endl; - } while (!good); - - int distance = 0; - int d1, d2; - int no1 = n1; //original - int no2 = n2; - while (n1 != 0 || n2 != 0) { - d1 = n1 % 10; - d2 = n2 % 10; - if (d1 != d2) - distance++; - n1 /= 10; - n2 /= 10; - } - cout << "Hamming distance between " << no1 << " and " << no2 << " is " << distance << endl; - return 0; -} |