int main() { double a=0.0, b=11.0, h=0.5, X; int n =6; double x[6], y[6]; fx(a,b,n,x); vivod ( x, n, "X"); fy(x,y,n); vivod ( y, n, "Y"); X=a; eytken(x,y,n,3.5); while(X<=b) { printf("X=%f eytken=%f f(X)=%f\n",X,eytken(x,y,n,X),f(X)); X+=h; } return 0; }
void main () { clrscr(); randomize(); //ochis("c:\\zbornaya.txt"); //dob("c:\\zbornaya.txt"); clrscr(); //vivodim("d:\\zbornaya.txt","Italy"); //vivodigr("d:\\zbornaya.txt","Zidane"); //redigr("d:\\zbornaya.txt","France","Zidane"); //redkom("d:\\zbornaya.txt","Italy"); //vivodim("d:\\zbornaya.txt","Italy"); vivod("c:\\zbornaya.txt"); //vivodpoz("c:\\zbornaya.txt","Vratar"); getch(); }
int main() { Student *first; Student *firstres; int h; char name1[Lmax],name2[Lmax]; printf("Input file name: "); gets(name1); printf("Output file name: "); gets(name2); first=stack(name1); printf("Input ball: "); scanf("%d",&h); if (first!=NULL) { firstres=stackres(first,h); vivod(firstres, name2); printf("Results saved in file %s\n", name2); } else { puts("No stack"); } return 0; }
int main(int argc, char **argv) { int sz=50; int i; double A[sz][sz]; int A_row,A_col; double *pA[sz]; for ( i=0; i<sz; ++i ) pA[i]=&A[i][0]; double b[sz]; int b_sz; double bp[sz]; int bp_sz; //для проверки double r1[sz]; int r1_sz; double r2[sz]; int r2_sz; double r3[sz]; int r3_sz; double r4[sz]; int r4_sz; input_matr(pA,&A_row,&A_col); vivod_matr(pA,A_row,A_col,"A"); input(b,&b_sz); vivod(b,b_sz,"b"); double x[sz]; int x_sz=b_sz; for(i=0; i<sz; i++) x[i]=10; for(i=0; i<100; ++i) { printf("Итерация = %d\t",i); vivod(x,x_sz,"x"); mnog_vec_matr (x, x_sz, pA, A_row,A_col, r1, &r1_sz); //r1=A*x // vivod(r1,r1_sz,"r1"); vecmin(r1,r1_sz,b,b_sz,r2,&r2_sz);//(rk=)r2=r1-b=A*x-b // vivod(r2,r2_sz,"r2"); mnog_vec_matr (r2, r2_sz, pA, A_row, A_col, r3, &r3_sz);//r3=A*rk // vivod(r3,r3_sz,"r3"); double chisl= scalmnog ( r2,r2_sz,r2,r2_sz);//chisl=r2*r2 // printf("chisl=%fl\n",chisl); double zn = scalmnog ( r2,r2_sz,r3,r3_sz);//zn=r2*r3 // printf("zn=%f\n",zn); double a=chisl/zn; // printf("a=%f\n",a); vecscal (a,r2,r2_sz,r4,&r4_sz);//r4=a*rk // vivod(r4,r4_sz,"r4"); vecmin(x,x_sz,r4,r4_sz,x,&x_sz); vivod(x,x_sz,"x"); } mnog_vec_matr(x,x_sz,pA,A_row,A_col,bp,&bp_sz); vivod(b,b_sz,"b"); vivod(bp,bp_sz,"bp"); return 0; }
int main(void) { init_spi(); init(); SysTick_Config(SystemCoreClock/2); adc_init(); lcd_fillL(); delay(0xFF); lcd_clearL(); delay(0xFF); lcd_fillR(); delay(0xFF); lcd_clearR(); delay(0xFF); set_xL(0); set_yL(0); delay(0xFF); while(1) { set_xL(0); set_yL(0); set_xR(0); set_yR(0); for(int l=0;l<4;l++) { switch(l) { case 1: { vivod(1,0,0, "1"); vivod(1,1,0, "2"); vivod(1,2,0, "3"); vivod(1,3,0, "4"); vivod(1,4,0, "5"); vivod(1,5,0, "6"); vivod(1,6,0, "7"); vivod(1,7,0, "8"); vivod(2,0,0, "-1"); vivod(2,1,0, "-2"); vivod(2,2,0, "-3"); vivod(2,3,0, "-4"); vivod(2,4,0, "-5"); vivod(2,5,0, "-6"); vivod(2,6,0, "-7"); vivod(2,7,0, "-8"); break; } case 2: { delay_ms(5); vivod(1,0,0,"9"); vivod(1,1,0, "10"); vivod(1,2,0, "11"); vivod(1,3,0, "12"); vivod(1,4,0, "13"); vivod(1,5,0, "14"); vivod(1,6,0, "15"); vivod(1,7,0, "16"); vivod(2,0,0, "-9"); vivod(2,1,0, "-10"); vivod(2,2,0, "-11"); vivod(2,3,0, "-12"); vivod(2,4,0, "-13"); vivod(2,5,0, "-14"); vivod(2,6,0, "-15"); vivod(2,7,0, "-16"); break; } case 3: { delay_ms(5); vivod(1,0,0,"17"); vivod(1,1,0, "18"); vivod(1,2,0, "19"); vivod(1,3,0, "20"); vivod(1,4,0, "21"); vivod(1,5,0, "22"); vivod(1,6,0, "23"); vivod(1,7,0, "24"); vivod(2,0,0, "-17"); vivod(2,1,0, "-18"); vivod(2,2,0, "-19"); vivod(2,3,0, "-20"); vivod(2,4,0, "-21"); vivod(2,5,0, "-22"); vivod(2,6,0, "-23"); vivod(2,7,0, "-24"); break; } } } delay_ms(5); // GPIO_SetBits( GPIOC, GPIO_Pin_9); // delay(10000000); // GPIO_ResetBits( GPIOC, GPIO_Pin_9); set_xL(0); set_yL(0); set_xR(0); set_yR(0); // GLCD_WriteStringL( "+--------+"); // delay_ms(5); // GLCD_WriteStringR("+--------+"); // delay_ms(5); lcd_clearL(); lcd_clearR(); // unsigned char m=Buffer[0]; // send_Uart(USART1, m); } }
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_SPI1_Init(); MX_SPI2_Init(); MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ lcd_fillL(); delay(0xFF); lcd_clearL(); delay(0xFF); lcd_fillR(); delay(0xFF); lcd_clearR(); delay(0xFF); set_xL(0); set_yL(0); delay(0xFF); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { set_xL(0); set_yL(0); set_xR(0); set_yR(0); for(int l=0;l<4;l++) { switch(l) { case 1: { vivod(1,0,0, "1"); vivod(1,1,0, "2"); vivod(1,2,0, "3"); vivod(1,3,0, "4"); vivod(1,4,0, "5"); vivod(1,5,0, "6"); vivod(1,6,0, "7"); vivod(1,7,0, "8"); vivod(2,0,0, "-1"); vivod(2,1,0, "-2"); vivod(2,2,0, "-3"); vivod(2,3,0, "-4"); vivod(2,4,0, "-5"); vivod(2,5,0, "-6"); vivod(2,6,0, "-7"); vivod(2,7,0, "-8"); break; } case 2: { delay(5); vivod(1,0,0,"9"); vivod(1,1,0, "10"); vivod(1,2,0, "11"); vivod(1,3,0, "12"); vivod(1,4,0, "13"); vivod(1,5,0, "14"); vivod(1,6,0, "15"); vivod(1,7,0, "16"); vivod(2,0,0, "-9"); vivod(2,1,0, "-10"); vivod(2,2,0, "-11"); vivod(2,3,0, "-12"); vivod(2,4,0, "-13"); vivod(2,5,0, "-14"); vivod(2,6,0, "-15"); vivod(2,7,0, "-16"); break; } case 3: { delay(5); vivod(1,0,0,"17"); vivod(1,1,0, "18"); vivod(1,2,0, "19"); vivod(1,3,0, "20"); vivod(1,4,0, "21"); vivod(1,5,0, "22"); vivod(1,6,0, "23"); vivod(1,7,0, "24"); vivod(2,0,0, "-17"); vivod(2,1,0, "-18"); vivod(2,2,0, "-19"); vivod(2,3,0, "-20"); vivod(2,4,0, "-21"); vivod(2,5,0, "-22"); vivod(2,6,0, "-23"); vivod(2,7,0, "-24"); break; } } } delay(5); set_xL(0); set_yL(0); set_xR(0); set_yR(0); lcd_clearL(); lcd_clearR(); /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ }
int main () {//printf ("To move the empty cell called [ 0 ] use 'u' to move up;'d' to move down;'l' to move left;'r' to move right; press 'q' to leave the game \n "); //FILE * myoutput=fopen ("myoutput.txt","w"); struct termios savetty, tty; char ch; /*if( !isatty( 0 ) ) { fprintf( stderr, "stdin not terminal\n" ); exit( EXIT_FAILURE ); }; tcgetattr( 0, &tty ); // получили состояние терминала savetty = tty; tty.c_lflag &= ~( ICANON | ECHO | ISIG ); tty.c_cc[ VMIN ] = 1; tcsetattr( 0, TCSAFLUSH, &tty ); */// изменили состояние терминала int k,i; struct tnode* root = NULL; //zapolnenie(mas); //vivod(mas); int mas [9] ={1,2,3,4,5,6,7,0,8};/*5,6,1,4,0,8,7,3,2};{1,2,3,4,5,0,8,7,6};*/ int p; function(&root, mas,0,1); while (top[0]->next!=NULL){ vivod (pop(0));} vivod (top[0]->A); for (p=1;p<9;p++){ if (compare(top[p-1]->A,winner,9)==0) break; function(&root, top[p-1]->A,p,1); while (top[p]->next!=NULL){ vivod (pop(p));} vivod (top[p]->A); }/*while (top[1]!=NULL){ free(top[1]); top[1]=top[1]->next; } function(&root, mas,2,1); while (top[2]!=NULL){ // sleep (2); vivod (pop(2)); } while (top[2]!=NULL){ free(top[2]); top[2]=top[2]->next; } function(&root, mas,3,1); while (top[3]!=NULL){ // sleep (2); vivod (pop(3)); } while (top[3]!=NULL){ free(top[3]); top[3]=top[3]->next; } //move(mas,k); tcsetattr( 0, TCSAFLUSH, &savetty ); // восстановили состояние терминала printf( "\n" ); exit( EXIT_SUCCESS ); */ //fclose (myoutput); return 0; }