hwk2-ks1655.cpp

# hwk2-ks1655.cpp - total = pow 2.0 7.0 if bin 7==1 total =...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 //Kevin Su // Cs1428 Sectio.253 // 2.12.11 I declared 8 integers to store binary data. Then I read and stored the data integers and defined them variables. After that I us e # include < iostream> # include < cmath> using namespace std int main () { unassigned int bin1,bin2,bin3,bin4,bin5,bin6,bin7,bin8 int total=0 cout << Ò Enter binary number to convert (8 digits) cin << bin1>> bin2>> bin3 << bin4 <<bin5<< bin6<< bin7<< bin8 if ( bin 8 ==1)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: total + = pow ( 2.0 , 7.0) if ( bin 7==1) total + = pow ( 2.0 , 6.0) if ( bin 6==1) total + = pow ( 2.0 , 5.0) if ( bin 5 ==1) total + = pow ( 2.0 , 4.0) if ( bin 4==1) total + = pow ( 2.0 , 3.0) if ( bin 3==1) total + = pow ( 2.0 , 2.0) if ( bin 2==1) total + = pow ( 2.0 , 1.0) if ( bin 1 ==1) total + = pow ( 1.0 , 1.0) cout << ÒIn decimal system (ÒPause>NuÓ) return 0 } Sheet1 Page 2 Ó Ó << total << endl...
View Full Document

## This note was uploaded on 09/30/2011 for the course PHYSICS 1410 taught by Professor Falco during the Spring '08 term at Texas State.

### Page1 / 2

hwk2-ks1655.cpp - total = pow 2.0 7.0 if bin 7==1 total =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online