int main() { float a; float b; int c; printf("Kolku denari se tarifira eden saat: "); scanf("%f", &a); a /= 60; printf("Koga e pocnat korisnikot: "); scanf("%d%d", &counterfrom.hour, &counterfrom.minutes); printf("Koga e zavrsen korisnikot: "); scanf("%d%d", &counterto.hour, &counterto.minutes); c = timecount(&counterfrom, &counterto); b = c*a; printf("Korisnikot ima da plati %.2f denari\n", b); printf("24 casa se tarifira %.2f denari\n", 1440*a); return 0; }
void game(void){//ゲーム内容 int j; gsetnonblock(ENABLE);//ノンブロッキングモードに while(1){ gclr(win);//画面消去 //防護壁のx座標設定(レベル5になるまで値変化) defence_x=rand()%400; if(defence_x > 320){//x座標が340を超えたら340以下の数を減らす defence_x -= rand()%320; } LEVEL5();//レベル5の動作 newpen(win, 1); level();// レベルの表記 timecount();//時間の表記 human();// 棒人間 input();//入力待ち for(i=0; i<kosu; i++){ j = rand() % 16;// 色はランダム if(j < 3) j = j + rand() % 10 + 3;//色は3〜15のどれか if(a > 2){ //レベル3、4でときどき黒になって消えて見える if(rand()%5 == 0) j = 0; } newpen(win, j); fillrect(win, x_sq[i], y_sq[i], w_sq[i], h_sq[i]);//四角 fillcirc(win, x_circ[i], y_circ[i], r_circ[i], r_circ[i]);//円 LEVEL4();//レベル4のみ出る円(半分を埋め尽くす円) //落下速度dx,dy y_sq[i] -= dy; y_circ[i] -= dy; LEVEL2();//レベル2以上で変化させる } atari();//当たり判定 msleep(time);// 0.1秒止める count++; if(count/10 == 20*a){// カウント10回=約1秒とする dy += rand()%2+1;//速度変化は毎回変わる dx += rand()%2;//揺れる大きさ a++;//レベル kosu+=rand()%2+1;//増やす個数は毎回変わる dh+=3;//通常四角の縦幅変化量 dw+=3;//通常四角の横幅変化量 dr+=3;//通常円の半径の変化量 } } }
void iniciarJuego(){ /*int nbombas = -1; while( nbombas < 0 || nbombas > 70 ){ printf("Numero de bombas: "); nbombas = getnum(); printf("%d\n", nbombas); }*/ int x,y; estado = ESTADO_EN_JUEGO; njugadas = 0; iniciaArr(); //PID es un identificador de procesos, cada vez // que un nuevo proceso se ejectua se le asigna un PID // diferente - Se necesita libreria - unistd.h //srand( getpid() ); //srand ( time(NULL) ); //agregaBombas( nbombas ); int nbombas = agregaBombas(); establecerNumeros(); int starttime = getTime(); while( estado == ESTADO_EN_JUEGO){ //estado en juego aboutMe(); timecount(starttime); print(); printf(WHITE "Fila: "); x = getnum(); printf(WHITE "%d\nColumna: ", x); y = getnum(); printf(WHITE "%d\n", y); jugadaEnGrupo(x,y); char str[] = {0x1b, 0x5b, 0x48, 0x1b, 0x5b, 0x4a, '\0'}; printf("%s", str); njugadas = contarJugadas(); if( njugadas == ( FILAS*COLUMNAS - nbombas) && estado != ESTADO_PERDEDOR){ estado = ESTADO_GANADOR; } } if( estado == ESTADO_PERDEDOR){ print(); printf(RED "perdiste\n"); printf(WHITE "Solucion: \n"); printAll(); }else{ printf(GREEN "Ganaste !\n"); printAll(); } }