#include #include #include #include #include #include #include #include #include #include #include using namespace std; void MM(int a[8], int b[4]) { b[0]=a[0]*a[4]+a[1]*a[6]; b[1]=a[0]*a[5]+a[1]*a[7]; b[2]=a[2]*a[4]+a[3]*a[6]; b[3]=a[2]*a[5]+a[3]*a[7]; } struct kek { int a[8]; int b[4]; int flag; }*temp; int main(int argc, char* argv[]) { int descriptor=open("hh", O_CREAT | O_RDWR , S_IRWXU); int id,i,j; bool g=true; int b[4]; key_t key=ftok("hh",1); id=shmget(key,sizeof(struct kek),IPC_CREAT| S_IRUSR | S_IWUSR); temp=(kek*)shmat(id,0,0); temp->flag=1; while(g) { MM(temp->a,b); for (i=0;i<4;i++) { temp->b[4]; } temp->flag=1; if(temp->flag==2) { g=false; } } shmdt(temp); shmctl(id,IPC_RMID,0); close(descriptor); return 0; }