Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <ctime>
- #include <cmath>
- #include <windows.h>
- #include <string>
- #define USTAW SetConsoleTextAttribute(handle,
- #define _X_ BACKGROUND_BLUE | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_INTENSITY );
- #define CZE FOREGROUND_RED |
- #define NIE FOREGROUND_BLUE |
- #define ZIE FOREGROUND_GREEN |
- #define INTENS FOREGROUND_INTENSITY |
- using namespace std;
- void color(short color=0);
- void convert();
- void print(string&, short a=0);
- void color(short color)
- {
- HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
- USTAW _X_
- switch(color)
- {
- case 0: USTAW CZE NIE ZIE INTENS _X_ break;
- case 1: USTAW CZE INTENS _X_ break;
- case 2: USTAW ZIE INTENS _X_ break;
- case 3: USTAW NIE INTENS _X_ break;
- case 4: USTAW NIE ZIE INTENS _X_ break;
- case 5: USTAW CZE NIE _X_ break;
- default: USTAW CZE NIE ZIE _X_ break;
- }
- }
- void print(string& napis, short a)
- {
- long long x1=time(NULL), x2;
- srand (time(NULL));
- if(!a)
- do
- {
- x2=time(NULL);
- color( rand()%4 +1 );
- cout<<napis<<"\r";
- }while(x2-x1<5);
- else
- for(int i=0;i<20;i++)
- {
- color( rand()%6 +1 );
- cout<<napis<<endl;
- }
- }
- void convert()
- {
- string* zyczenia=new string[24];
- for(int i=0; i<24; i++)
- cin>>zyczenia[i];
- int tab[24][8];
- for(int i=0;i<24; i++)
- for(int j=0;j<8;j++)
- {
- if(zyczenia[i][j]=='0') tab[i][j]=0;
- if(zyczenia[i][j]=='1') tab[i][j]=1;
- }
- string z="Zaczekaj...";
- print(z);
- string a;
- int suma=0, x=0;
- for(int i=0;i<24;i++)
- {
- for(int j=0; j<8; j++)
- suma+=tab[i][j]*pow(2,7-j);
- a+=(char) (suma);
- suma=0;
- }
- a="==> "+ a;
- print(a, 1);
- }
- int main()
- {
- convert();
- getch();
- return 0;
- }
- /*
- 01010111 01110011 01111010 01111001 01110011 01110100 01101011 01101001 01100101 01100111 01101111 00100000 01001110 01100001 01101010 01101100 01100101 01110000 01110011 01111010 01100101 01100111 01101111 00100001
- */
Advertisement
Add Comment
Please, Sign In to add comment