Answer to Question #15125 in C++ for Zac

Question #15125
Convert 11001100 in two's complement representation (in 8 bits) to a base ten integer.
1
Expert's answer
2012-09-21T10:15:57-0400
#include "iostream.h"
#include "math.h"

void main(){

int c [8] = { 1, 1, 0, 0, 1, 1, 0, 0 };
int a = 0;
for (int i=0; i<=7; i++)
& a += c[i]*pow(2,i);
cout<<a<<"\n";

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS