The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C++ Code
Posted by: Conveyer | December 15, 2010 @ 1:34pm
C++ Code
[
Download
]
// conveyor.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> int main(int argc, char** argv) { char mass[3][3][4]; char result[3][12]; char result_binary[3][12]={0}; char mass_binary[3][3][4]={0}; int i,j,k,l,t,position; //C�������� ����� �� ���������� ���������� ��������� ��� � ��������� FILE *f=fopen("1.txt","r"); fread(mass[0][0],1,4,f); fseek(f,2,SEEK_CUR); fread(mass[0][1],1,4,f); fseek(f,2,SEEK_CUR); fread(mass[0][2],1,4,f); fseek(f,2,SEEK_CUR); fclose(f); f=fopen("2.txt","r"); fread(mass[1][0],1,4,f); fseek(f,2,SEEK_CUR); fread(mass[1][1],1,4,f); fseek(f,2,SEEK_CUR); fread(mass[1][2],1,4,f); fseek(f,2,SEEK_CUR); fclose(f); f=fopen("3.txt","r"); fread(mass[2][0],1,4,f); fseek(f,2,SEEK_CUR); fread(mass[2][1],1,4,f); fseek(f,2,SEEK_CUR); fread(mass[2][2],1,4,f); fseek(f,2,SEEK_CUR); fclose(f); for(k=0;k<3;k++) for(i=0;i<3;i++) for(j=0;j<4;j++) { result[k][i*4+j]='0'; if(mass[k][i][j]=='0') mass_binary[k][i][j]=0; else mass_binary[k][i][j]=1; } //����������� ����������� ��� ���������� ���� ���� ��� //� 3-� ��������� 12-�� ���������� ��������� position=0; t=0; do { for(i=0;i<3;i++) for(j=0;j<4;j++) if(mass_binary[t%3][i][j]==1) { result_binary[i][j+position]=1; result[i][j+position]=mass[t%3][i][j]; } t++; for(k=0;;k++) { l=0; for(i=0;i<3;i++) for(j=0;j<4;j++) if(result_binary[i][j+k]==mass_binary[t%3][i][j] && mass_binary[t%3][i][j]==1) { l=1; i=3; j=4; } if(l==0) break; } position=k; } while(position+2 < 12); // } while(position+3 < 12); ���� �������� ������� ��� ��� ����� f=fopen("Result.txt","w"); fwrite(result[0],1,12,f); fprintf(f,"\n"); fwrite(result[1],1,12,f); fprintf(f,"\n"); fwrite(result[2],1,12,f); fprintf(f,"\n"); fclose(f); return 0; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.62 / 8
69 Votes
http://codebin.yi.org/1014
page generated in 0.00 seconds