U E D R , A S I H C RSS

압축알고리즘/슬이,진영

Describe 압축알고리즘/슬이,진영 here.
~cpp 
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

void main()
{
	char input[20];
	cout <<"압축 대상을 입력하세요 :";
	cin >> input;
	int count=0;
	int output=0;
	char first = input[0];
	int index = 0;
	int temp =0;
	cout << first;
	while(input[index]!=NULL)
	{
		if(input[index]==first){
			output=0;
			cout << output;
		}
		else {
			cout << (int)(input[index] - first);
		}
		index++;
	}
	
	cout <<"압축을 해제 할께요 :";
	char input2[20];
	cin >> input2;
	char firch = input2[0];
	index = 1;
	while(input2[index] != NULL)
	{ 
		char c = input2[index];
		int x = atoi(&c);
		temp = (int)firch + x;
		cout << (char)temp;
		index++;
	}

	/*int count=1;
	int index =0;
	while(input[index]!=NULL)
	{
		if(input[index]==input[index+1])
			count++;
		else
		{
			cout<<count<<input[index];
			count =1;
		}
		index++;
	}

	cout <<"이제부터 해제합니다."<< endl;
	cin>> input;
	int i=0;
	while(input[i]!=NULL)
	{
		int n = atoi(&input[i]);
		char ch = input[i+1];
		i+=2;
		for(int i=0; i < n ; i++)
			cout << ch;
	}
	*/	
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0849 sec