hwk2-ks1655.cpp - total + = pow ( 2.0 , 7.0) if ( bin 7==1)...

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

View Full Document Right Arrow Icon
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)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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 &lt;&lt; In decimal system (Pause&gt;Nu) return 0 } Sheet1 Page 2 &lt;&lt; total &lt;&lt; endl...
View Full Document

Page1 / 2

hwk2-ks1655.cpp - total + = pow ( 2.0 , 7.0) if ( bin 7==1)...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online