#include <stdio.h>
#define M 201
int hossz(char c[]){
int i;
for(i = 0; c[i]!= '\0'; i++);
return i;
}
int main(){
int tipus;
int oszlopsz;
char bes[M];
char kis[M];
int i, j, l;
//beolvas
FILE
*be
= fopen("be.txt","r");
fscanf(be
,"%d %d", &tipus
, &oszlopsz
);
int kulcs[oszlopsz];
for(i = 0; i < oszlopsz; i++ ){
}
//sor
int h = hossz(bes);
int sor = h / oszlopsz;
char s[sor][oszlopsz];
//kodolas
if(tipus == 1){
int k = 0;
for(i = 0; i < sor; i++){
for(j = 0; j < oszlopsz; j++){
s[i][j] = bes[k];
k++;
}
}
k = 0;
for(i = 0; i < oszlopsz; i++){
for(j = 1; j <= oszlopsz; j++){
if(kulcs[i] == j){
for(l = 0; l < sor; l++){
kis[k] = s[l][j-1]; //j-1 mert 0-6 ig van elem
k++;
}
}
}
}
}else{ //dekodolas
int k = 0;
for(i = 0; i < oszlopsz; i++){
for(j = 1; j<=oszlopsz; j++){
if(kulcs[i] == j){
for(l = 0; l < sor; l++){
s[l][j-1] = bes[k];
k++;
}
}
}
}
k = 0;
for(i = 0; i < sor; i++){
for(j = 0; j < oszlopsz; j++){
kis[k] = s[i][j];
k++;
}
}
}
//kiiras fajlba
FILE
*ki
= fopen("ki.txt","w");
for(i=0; i<h; i++){
}
return 0;
}
{"text":"text","html5":"html","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"lua","bash":"sh","erlang":"erlang","go":"golang","c":"c_cpp","cpp":"c_cpp","diff":"diff","latex":"latex","sql":"sql","xml":"xml","0":"text","abap":"abap","actionscript":"actionscript","actionscript3":"actionscript","ada":"ada","apache":"apache_conf","applescript":"applescript","asm":"assembly_x86","autohotkey":"autohotkey","closure":"closure","cobol":"cobol","coffeescript":"coffee","cpp-winapi":"c_cpp","c_loadrunner":"c_cpp","c_mac":"c_cpp","c_winapi":"c_cpp","csharp":"csharp","d":"d","dart":"dart","dot":"dot","eiffel":"eiffel","fortran":"fortran","groovy":"groovy","haskell":"haskell","haxe":"haxe","ini":"ini","io":"io","java":"java","java5":"java","make":"makefile","matlab":"matlab","mysql":"mysql","objc":"objectivec","ocaml":"ocaml","pascal":"pascal","perl":"perl","perl6":"perl","postgresql":"pgsql","powershell":"powershell","prolog":"prolog","properties":"properties","rails":"ruby","rust":"rust","scala":"scala","scheme":"scheme","smarty":"smarty","tcl":"tcl","vala":"vala","vb":"vbscript","verilog":"verilog","vhdl":"vhdl","yaml":"yaml"}