#include <stdio.h>
using namespace std;
int main() {
string binary;
int accum = 0;
int add = 255;
printf("Enter binary digits:\n");
scanf("%s", binary); //might need a space in front of that % sign...
add = 128;
for(int i = 0; i < 8; i++) {
if(binary.substr(i, 1) = "1") { accum = accum + add; }
add = add / 2;
}
printf("%sb = %d\n",binary, accum);
return 0;
}
just off the top of my head... to get rid of iostream all together... I nevered used it... doesn't seem necessary for now...