void menu() { int ch; x: void game(); void instruct(); void subscribe(); cout<<"\n\n\t\t1.INSTRUCTIONS\n\t\t2.GAME\n\t\t3.SUBSCRIPTION\n\t\t4.EXIT\n"; cin>>ch; if(ch==1) instruct(); if(ch==2) game(); if(ch==3) subscribe(); if(ch>3) { cout<<"wrong choice"; exit(0); } goto x; }
int main(void){ double radius; double height; double material_cost; int quantity; double surface_area; double total_cost; instruct(); printf("Radius in cm: "); scanf("%lf", &radius); printf("Height in cm: "); scanf("%lf", &height); printf("Material cost in $/cm^2: "); scanf("%lf", &material_cost); quantity = get_quantity(); surface_area = comp_area(height, radius); total_cost = material_cost * surface_area * quantity; print_area_cost(surface_area, total_cost); return 0; }
newgame() { if (Newgame <= 0) { instruct(); Game = 0; /* while(Getc()!=-1) ; /* flush keyboard queue */ while (Game==0 && Running) kbpoll(); } else Game = Newgame; if ( !Running ) return; black(); switch ( Game ) { case 1: Seekprob = 40; Seekinc = 10; Monbase = 40; Pacman.time = 43; break; case 2: Seekprob = 80; Seekinc = 2; Monbase = 30; Pacman.time = 35; break; case 3: Seekprob = 100; Seekinc = 0; Monbase = MINMONTIME; Pacman.time = MINPACTIME; break; case 4: Seekprob = 90; Seekinc = 0; Monbase = 0; Pacman.time = 0; } Newgame = 0; Pacman.alive = TRUE; Wave = 0; Score = 0; Nextbonus = SCOREMOD; settextop(REPLACE); mvprintf(SCOREROW,1,"S C O R E : "); addscore(0); addscore(FLUSHSCORE); #ifdef HIGHSCORE if ( Highscore[Game-1] != NOSCORE ) mvprintf(SCOREROW,HIGHCOL,"H I G H S C O R E : %D",(long)Highscore[Game-1]); #endif Pacmen = 1; mvprintf(WAVEROW,WAVECOL,"W A V E : "); addmen(PACMEN-1); pacnew(); monnew(); }
void ImageWindowItem::onStartActionTriggerd() { InstructionProxy instruct(cmosNumber); if(!instruct.AECRun()) { QMessageBox::critical(this, tr("Error"), tr("Failed to upload data!")); return; } uploadFlag = true; }
bool ImageWindowItem::onStopActionTriggerd() { InstructionProxy instruct(cmosNumber); if(!instruct.Stop()) { QMessageBox::critical(this, tr("Error"), tr("Failed to stop uploading!")); return false; } uploadFlag = false; return true; }
Instruction GameRoom::getUsersInstruction() const { Instruction instruct(Instruction::GETALLUSERSINROOM); IMutex *mutex = (*MutexVault::getMutexVault())["room" + this->name]; mutex->lock(true); for (std::vector<User *>::const_iterator it = this->users.begin(); it != this->users.end(); it++) instruct.addName((*it)->getName()); mutex->unlock(); return (instruct); }
void intro(void) { char chr; clrscr(); puts("Welcome to Shooter97!"); puts(" "); puts("For instructions press I, to play the game press P."); chr = getch(); if ((chr == 'I') || (chr == 'i')) { instruct(); } }
bool GameRoom::removeAllUsers() { RTypeServer *server = RTypeServer::getInstance(); IMutex *mutex = (*MutexVault::getMutexVault())["room" + this->name]; Instruction instruct(Instruction::LEAVE_ROOM); mutex->lock(true); while (this->users.size() > 0) { server->sendToClient(this->users[0], instruct); this->users[0]->detachRoom(); } mutex->unlock(); return (true); }
int main(void) { double height,surface_area,radius1,radius2; instruct();//call the instructon message function printf("\n\nEnter the height of the cylinder>\n");//get input scanf("%lf",&height); printf("Enter the surface area of the cylinder>\n"); scanf("%lf",&surface_area); radius1 = (-2*PI*height+sqrt(pow(2*PI*height,2) - 4*2*PI*(-surface_area)))/(2*2*PI);//formula for calculeting radius2 = (-2*PI*height-sqrt(pow(2*PI*height,2) - 4*2*PI*(-surface_area)))/(2*2*PI); printf("\nThe radius of the cylinder is %.2f or %.2f(negative value not acceptable)\n",radius1,radius2);//display result thanks();//call the thank message function return(0); }
int main() { printf("\t\aWelcome!!\n"); int i,Guess_num,result; char ch1='H'; char ch2='h'; char ch; rand(); printf("To know how to play this game press 'H'\n"); scanf("%c",&ch); if(ch==ch1||ch2){ instruct(); } for(i=1;i<=5;i=i+1){ printf("\nEnter your Guess number>\n"); scanf("%d",&Guess_num); result = rand() - Guess_num; if(result>0){ printf("Your Guess number is worng!!It %d higher than your number.\n",result+2); } else if(Guess_num==rand()) { printf("\aYour Guess is correct.you win^^\n"); thanks(); getch(0); } else { printf("Your Guess number is worng!!It %d lower than your number.\n",result*(-1)); } } printf("\n\n\aGame is over.You are a looser!!!\tTry again.\n"); thanks(); getch(0); }
void ImageWindowItem::onDgActionTriggerd() { if (!uploadFlag) { QMessageBox::critical(this, tr("Error"), tr("Data has not been upload! Please click the dataupload button!")); return; } InstructionProxy instruct(cmosNumber); bool ok; double value = QInputDialog::getDouble(this, tr("digital gain setting"), tr("input digital gain:"), m_dg, 0, 10, 1, &ok); if (ok) { m_dg = value; if(!instruct.SetDG(m_dg)) { QMessageBox::critical(this, tr("Error"), tr("Failed to set DG!")); return; } uploadFlag = true; } }
void ImageWindowItem::onFpsActionTriggerd() { if (!uploadFlag) { QMessageBox::critical(this, tr("Error"), tr("Data has not been upload! Please click the dataupload button!")); return; } InstructionProxy instruct(cmosNumber); bool ok; int value = QInputDialog::getInt(this, tr("frame rate setting"), tr("input fps:"), m_frRate, 0, 50, 1, &ok); if (ok) { m_frRate = value; if (!instruct.SetFPS(m_frRate)) { QMessageBox::critical(this, tr("Error"), tr("Failed to set frame rate!")); return; } uploadFlag = true; } }
void ImageWindowItem::onExpoActionTriggerd() { if (!uploadFlag) { QMessageBox::critical(this, tr("Error"), tr("Data has not been upload! Please click the dataupload button!")); return; } InstructionProxy instruct(cmosNumber); bool ok; int value = QInputDialog::getInt(this, tr("exposure time setting"), tr("input exposure time:"), m_expoTime, 0, 180000 / m_frRate, 1, &ok); if (ok) { m_expoTime = value; if(!instruct.setExpoTime(m_expoTime)) { QMessageBox::critical(this, tr("Error"), tr("Failed to set exposure time!")); return; } uploadFlag = true; } }
void ImageWindowItem::onAg_cgActionTriggerd() { if (!uploadFlag) { QMessageBox::critical(this, tr("Error"), tr("Data has not been upload! Please click the dataupload button!")); return; } InstructionProxy instruct(cmosNumber); QStringList list; list << tr("1.00") << tr("1.14") << tr("1.33") << tr("1.60") << tr("2.00") << tr("2.29") << tr("2.67") << tr("3.20") << tr("4.00") << tr("5.33") << tr("8.00"); bool ok; int listNum; if (m_ag_cg == 1.00) listNum = 0; else if (fabs(m_ag_cg - 1.14) <= 0.1) listNum = 1; else if (fabs(m_ag_cg - 1.33) <= 0.1) listNum = 2; else if (fabs(m_ag_cg - 1.60) <= 0.1) listNum = 3; else if (fabs(m_ag_cg - 2.00) <= 0.1) listNum = 4; else if (fabs(m_ag_cg - 2.29) <= 0.1) listNum = 5; else if (fabs(m_ag_cg - 2.67) <= 0.1) listNum = 6; else if (fabs(m_ag_cg - 3.20) <= 0.1) listNum = 7; else if (fabs(m_ag_cg - 4.00) <= 0.1) listNum = 8; else if (fabs(m_ag_cg - 5.33) <= 0.1) listNum = 9; else if (fabs(m_ag_cg - 8.00) <= 0.1) listNum = 10; QString valueStr = QInputDialog::getItem(this, tr("AG&CG setting"), tr("input total gain"), list, listNum, false, &ok); if (ok&&!valueStr.isEmpty()) { m_ag_cg = valueStr.toFloat(&ok); if(!instruct.SetAGCG(m_ag_cg)) { QMessageBox::critical(this, tr("Error"), tr("Failed to set AG_CG!")); return; } uploadFlag = true; } }
void main() { int gd=DETECT, gm, ch, ch1; initgraph(&gd,&gm,"c:\\tc\\bgi"); pamplet(); loading(); cls; spedometer(a,b); instruct(); while(1) { counter+=10; car(x,y); x1 = 120 + (random(6)*50); y1 = 10; enemy_car(x1,y1); enemy_car1(x1,y1); while(y1 <= getmaxy() + 40) { enemy_car_clear(x1,y1); enemy_car_clear1(x1,y1); y1+=10; y2+=10; enemy_car(x1,y1); enemy_car1(x1,y1); if(((y1+89) >= y) && (((x>=x1) && (x<=x1+70)) || (x<=x1 && x+70>=x1+10))) { accident(); } if(kbhit()) { ch = getche(); if(ch==77) { temp++; if(x>=340) { x-=70; car(x,y); } car_clear(x,y); x+=70; car(x,y); } if(ch==75) { if(x<=150) { x+=70; car(x,y); } car_clear(x,y); x-=70; car(x,y); } if(ch==27) { ExitGame(); } } delay(random(10)); } delay(1); } }
int main(int ac, char **av) { std::string s; std::string token; size_t pos; Instruction instruct(Instruction::KO); ISocket *servTcp = getClient(); /* try { servTcp->attachOnReceive(&recvHandler); instruct.setInstruct(Instruction::CONNEXION); instruct.addName("fabY"); servTcp->writePacket(Packet::pack(instruct)); #ifdef _WIN_32 Sleep(100); #else usleep(10000); #endif instruct.setInstruct(Instruction::CREATE_ROOM); servTcp->writePacket(Packet::pack(instruct)); #ifdef _WIN_32 Sleep(100); #else usleep(10000); #endif instruct.setInstruct(Instruction::START_GAME); servTcp->writePacket(Packet::pack(instruct)); #ifdef _WIN_32 Sleep(100); #else usleep(10000); #endif game(); } catch (BBException &err) { std::cerr << err.what() << std::endl; system("pause"); } */ while (s != "quit") { instruct.eraseNames(); std::getline(std::cin, s); if ((pos = s.find(" ")) != s.npos) { token = s.substr(0, pos); if (token == "connect") instruct.setInstruct(Instruction::CONNEXION); else if (token == "join") instruct.setInstruct(Instruction::JOIN_ROOM); else if (token == "create") instruct.setInstruct(Instruction::CREATE_ROOM); s.erase(0, pos + 1); if (s.size() > 0) { instruct.addName(s); servTcp->writePacket(Packet::pack(instruct)); } } else if (s == "roomusers") { instruct.setInstruct(Instruction::GETALLUSERSINROOM); servTcp->writePacket(Packet::pack(instruct)); } else if (s == "users") { instruct.setInstruct(Instruction::GETALLUSERNAMES); servTcp->writePacket(Packet::pack(instruct)); } else if (s == "rooms") { instruct.setInstruct(Instruction::GETALLROOMNAMES); servTcp->writePacket(Packet::pack(instruct)); } else if (s == "disconnect") { instruct.setInstruct(Instruction::DECONNEXION); servTcp->writePacket(Packet::pack(instruct)); } else if (s == "leave") { instruct.setInstruct(Instruction::LEAVE_ROOM); servTcp->writePacket(Packet::pack(instruct)); } else if (s == "start") { instruct.setInstruct(Instruction::START_GAME); servTcp->writePacket(Packet::pack(instruct)); game(); break; } //servUdp->writePacket(Packet::pack<std::string>(s)); } servTcp->cancel(); #ifdef _WIN_32 Sleep(1000); #else sleep(1); #endif delete servTcp; return (0); }