#include #include #include //use: tofile [-f] [pages-in-pamphlet] FILE* f; int i,total,b,ii,ost,tp; int tostd=1;//if prints to std -- adds comments to it void first(int N, int i) { int tp4 = (int)N/4; if (tostd) printf("\tside # 1\n"); fprintf(f,"\n"); for (ii=1; ii 2) tp=atoi(argv[2]); b = (int)total/tp; ost=total%tp; if (ost%4 > 0 || tp%4 >0){ fprintf(stderr, "Число страниц не делится на 4"); return(1); } for (i=0; i < b; i++){ if (tostd) printf("\nTetrad' # %d\n", i+1); first(tp,i); second(tp,i); } if ( ost>0 ){ if (tostd) printf("\nLast tetrad'\n"); first(ost,b); second(ost,b); } fclose(f); return 0; }