All pastes #396099 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-15 14:39 UTC
rendered paste body
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[]) {
	int input_size=20;
	int output_size=4;
	//char input[input_size];
	char input[]={'/','/','/','/','d','3','z','|','^','~','`','?','a','e','h','3','h','j','g','g'};
	int bits_list[input_size*8];
	int temp_array[output_size*4];
	char output[output_size];
	int x=0;
	int y=0;
	int count=0;
	
	for (x=0;x<input_size;x++) {
		input[x]='0';
	}
	
	//cin >> input;
	
	for (x=0;x<output_size;x++) { //clears output array
		output[x]='0';
	}
	
	
	for (x=0;x<input_size;x++) {
		for (y=7;y>=0;y--) {
			bits_list[count]= input[x] >> y;
			//cout << bits_list[count] << "|";
			count++;
		}
		//cout << endl;
	}
	
	//cout << endl;
	for (x=0;x<input_size*8;x++) {
		if (bits_list[x] % 2 != 0) {
			temp_array[x%36]++;
			//cout << temp_array[x%36];
		}
	}
	
	for (x=0;x<output_size;x++) {
		for (y=0;y<8;y++) {
			if (temp_array[(x+1)*(y+1)-1]%2 == 1) {
				output[x]= ((int)pow(2,y)) | output[x];
				//cout << (pow(2,y)) << " | ";
			}
		}
	}		
	
	cout << endl;
	for (x=0;x<output_size;x++) {
		cout << output[x];
	}
	cout << endl;
	
	return 0;
}