Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- #include "ConsolCyr.h"
- #include "cstdlib"
- #include "cmath"
- #include <string>
- //#include <stdafx>
- #include <fstream>
- using namespace std;
- int codegive(int*, char*, int, int);
- void zero(int*, int);
- void codewright(int*, char*, int, int*);
- int main()
- {
- const int NotUsed = system( "color 70" );
- char *s = new char[81];
- char *t = new char[10000];
- int *code = new int[256];
- int *stat= new int[256];
- int j=0;
- zero(code, 256);
- zero(stat, 256);
- do{ j=codegive(code, s , 81, j);}
- while(s[0]!='-');
- //for(int i=0; i<j-1; i++){cout << code[i] << ' '<< j<< endl;}
- codewright(code, s, j-2, stat);
- system("pause");
- }
- void zero(int* arrayptr, int length){
- for(int i=0; i<length; i++){
- arrayptr[i]=0;
- }}
- int codegive(int* arraycode, char* arrayptr, int length, int j){
- ifstream fin("code.txt");
- for(int i=0; i<length; i++){
- //fin >> arrayptr[i];
- //ifstream fin("code.txt",ios::in);
- //fin >> arrayptr[i];
- if(arrayptr[i]=='-'){break;}
- arraycode[j]+=arrayptr[i];
- if(arraycode[j]>256){arraycode[j]-=256;};
- fin.close();
- }
- j++;
- return j;
- }
- void codewright(int *arraycode, char* arrayptr, int j, int* stat){
- int c=0;
- int k=0;
- do{
- cin >> arrayptr[c];
- if(k>j){k-=(j+1);};
- arrayptr[c]+=arraycode[k];
- if (arrayptr[c]>256){arrayptr[c]-=256;};
- stat[arrayptr[c]]++;
- cout << arrayptr[c];
- if(arrayptr[c]=='\n'){cout << endl;};
- k++;
- c++;}
- while(arrayptr[c]!='@');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement