Skip to content

Instantly share code, notes, and snippets.

@dertst
Last active November 15, 2018 10:22
Show Gist options
  • Save dertst/3605aef4b578c227f534c7d4277e6ccc to your computer and use it in GitHub Desktop.
Save dertst/3605aef4b578c227f534c7d4277e6ccc to your computer and use it in GitHub Desktop.
#include "stdafx.h"
#include <stdio.h>
#include <Windows.h>
void Vvod(char **arr,int &d,int &size)
{
int i=0;
while(i != EOF)
{
scanf_s( "%c", &arr[i]);
i++;
}
}
void Shifrovka(char **arr, int &d, int &size)
{
for (int i = 0; i < size; i++)
{
for (int j = 0; j < d; j++)
{
printf("%c", arr[i][j]);
}
}
}
void Deshifrovka(char **arr, int &d, int &size)
{
for (int i = 0; i < size; i++)
{
for (int j = 0; j < d; j++)
{
printf("%c", arr[i][j]);
if ((i%size == 0) || (i%size == 1) || (i%size == 2) || (i%size == 3))
{
printf("\n");
}
}
}
}
int main()
{
printf("vvedite clych");
printf("\n");
int size;
int d;
scanf_s("%d",&d);
printf("\n");
printf("vvedite dlinnu palki");
printf("\n");
scanf_s("%d",&size);
printf("\n");
char **arr;
arr = (char **)malloc((d*size) * sizeof(int));
Vvod(arr,d,size);
Shifrovka(arr, d, size);
Deshifrovka(arr, d, size);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment