Example #1
0
void showCredits(sf::RenderWindow& app)
{
  Credits credit(app);

  //Credits loop
  while (app.IsOpened()) {

    //Process events
    sf::Event Event;

    //Window closed
    while (app.GetEvent(Event)) 
    {
      if(Event.Type == sf::Event::Closed)
        app.Close();

      //Escape key pressed
      if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))	
        app.Close();
    }

    if (credit.showCredits())
    {
      app.Clear();
      credit.update();
      app.Display();
      continue;
    }
    else
    {
      break;
    }
  }
}
Example #2
0
int main()
{

    /* Gera variáveis globais : board e melhor jogada */

    int i, caso, exit=0;
    char num;

    char **board = (char **) malloc (sizeof(char *) * 3);
    for (i=0; i<3; i++) {
        board[i] = (char *) malloc (sizeof(char) * 3);
    }


    while (exit != 5) {
        cabecario();
        /* Inicia o jogo printando as instruções de uso e inicializando o tabuleiro */

        init_board(board);
        /* Joga o jogo */

        printf("\t\t\t\t\t\t Escolha uma opção de jogo: \n");
        printf("\t\t\t\t\t\t |1- Um jogador\n");
        printf("\t\t\t\t\t\t |2- Dois jogadores\n");
        printf("\t\t\t\t\t\t |3- Ganhadores Anteriores\n");
        printf("\t\t\t\t\t\t |4- Créditos\n");
        printf("\t\t\t\t\t\t |5- Sair\n");
        scanf(" %c", &num);
        caso= letrapranum(num);
        switch(caso)
        {
        case 1:
            umjogador(board);
            break;
        case 2:
            doisjogadores(board);
            break;
        case 3:
            leiaarq();
            break;
        case 4:
            credit();
            break;
        case 5:
            system("clear");
            exit = 5;
            break;
        default:
            printf("Inválido");
        }
    }

    return 0; // Controle nunca deve chegar aqui
}
Example #3
0
void *threadMain(void *arg)
{
	int i;
	int amount;

	for (i=0; i<count; i++) {
		amount = 1;
		credit(account, amount);
	}
	pthread_exit(NULL);
}
Example #4
0
  // override update validation
  bool uvalidate( void  ) 
  { 
    // get the original status 
    ocString sqlStatus = "select Order_Status_Id from Orders where Id = ";
    sqlStatus.append(key());
    if( rs.open(sqlStatus) )
    {
      long long statusVal = atoll(rs.getField(0).format().c_str());
      rs.close();
      // check all affirmative cases, not related to the 'Shipped' transition
      if( statusVal == Order_Status_Id || // nothing changed
          ( statusVal > os_awaiting_shipment && // not orig awaiting shipment
            Order_Status_Id > os_awaiting_shipment // not set back to await ship 
          ) ) 
      {
        return true;
      }
      else if(  statusVal == os_awaiting_shipment &&
                ( Order_Status_Id == os_shipped ||
                  Order_Status_Id == os_recieved ) )
      {
        // do cc order finalization
         if( postauth() ) 
         {
           // set the ship date to NOW
           Ship_Date.now();
          
           // set the reconciliation date to NOW + 1 month 
           // (for charge-back protection.)
           Reconcile_Date.now();
           Reconcile_Date.addMonths(1);

                      
           // return cc success result
           return true;
         }
      }
      else if(  statusVal == os_awaiting_shipment &&
                ( Order_Status_Id == os_cancelled ||
                  Order_Status_Id == os_returned ) )
      {
        // do cc order reversal
        if( credit() )
        // return cc success result
        return true;
      }     
      else
      {
        m_result = "<b>NO CHANGE MADE!</b> It's illegal to change the status that way!";
      }            
    }
    return false; 
  } 
Example #5
0
int main()
{

    char a[5],b[5], c[5], d[5];
    int s1,s2,s3,s4, s,n, i=0;
    scanf("%d",&n);
    while(i<n)
    {
    scanf("%s %s %s %s",&a,&b,&c,&d);
    s1=credit(a);
    s2=credit(b);
    s3=credit(c);
    s4=credit(d);
    s=s1+s2+s3+s4;
    if(s%10==0)
        printf("Valid\n");
    else
        printf("Invalid\n");
    i++;
    }
return 0;
}
Example #6
0
int main()
{
    resetgame();
    //prints the Main Menu
    mainmenu(cursor);

    char key;

    //Detect key UP and DOWN until ENTER is pressed
    do
    {
        key = getch();  //Get the input
        switch(key)
        {
            case 72 :
                mainmenu(--cursor); //Select upper menu
                break;
            case 80 :
                mainmenu(++cursor); //Select lower menu
                break;
        }
    } while(key!=13);

    //Launch a game or screen depending on the menu selected
    switch(cursor)
    {
        case 1 :
            singlegame();
            break;
        case 2 :
            multigame();
            break;
        case 3 :
            battlegame();
            break;
        case 4 :
            howtoplay();
            break;
        case 5 :
            credit();
            break;
        case 6 :
            exit(1);    //Exit game
    }
}
Example #7
0
File: at.c Project: hw-1/iphone-sms
int main(int argc, char **argv)
{
  const char * hehe = RE;
  int fd;
  
  credit();

  if (argc != 1)
    usage(argv[0]);
  
  //RestartBaseband();
  fd = InitConn(115200);

  AT(fd);
  DeleteAllSMS(fd);

  close(fd);
  return 0;
}
//Show Menu
void SavingAccount::showMenu()
{
	char choice;
	do
    {
        system("cls");
        cout<<"+========================================+"<<endl;
        cout<<"|       Saving Account  Management       |"<<endl;
        cout<<"+========================================+"<<endl;
        cout<<"| 1. View Balance                        |"<<endl;
        cout<<"| 2. View Interest Amount                |"<<endl;
        cout<<"| 3. Credit                              |"<<endl;
        cout<<"| 4. Debit                               |"<<endl;
        cout<<"| 0. Exit to main menu                   |"<<endl;
		cout<<"+----------------------------------------+"<<endl;
        cout<<"| Your selection(0->2): ";
        fflush(stdin);
        cin>>choice;
        
        if(choice=='0') break;
        switch(choice)
        {
	        case '1':
				viewBalance();
	            break;
	        case '2':
	            calculateInterest();
	            break;
	        case '3':
	            credit();
	            break;
	        case '4':
	            debit();
	            break;
	        default:
				cout<<"Wrong choice!"<<endl;
	        	system("pause");
	        	break;
        }
    }while(1);
}
Example #9
0
void Credits()
{
    std::ifstream credit("Credits.txt");
    
    std::vector<std::string> tokens;
    std::istream_iterator<std::string> it(credit), end;

    std::for_each(it, end, [&] (const std::string& str)
    {
        std::cout << str << " ";
        if (str == "\\n")
            tokens.push_back("\n");
        else
            tokens.push_back(str);
    });

    std::ofstream out("temp.txt"); // create a temporary file
    // copy vector to file and rename
    std::copy(tokens.begin(), tokens.end(), std::ostream_iterator<std::string>(out));
    std::rename("temp.txt", "Credits.txt");
};
Example #10
0
void receiver::drain() {
    link_context &ctx = link_context::get(pn_object());
    if (ctx.draining)
        throw proton::error("drain already in progress");
    else {
        ctx.draining = true;
        if (credit() > 0)
            pn_link_set_drain(pn_object(), true);
        else {
            // Drain is already complete.  No state to communicate over the wire.
            // Create dummy flow event where "drain finish" can be detected.
            pn_connection_t *pnc = pn_session_connection(pn_link_session(pn_object()));
            connection_context& cctx = connection_context::get(pnc);
            // connection_engine collector is per connection.  Reactor collector is global.
            pn_collector_t *coll = cctx.collector;
            if (!coll)
                coll = pn_reactor_collector(pn_object_reactor(pnc));
            pn_collector_put(coll, PN_OBJECT, pn_object(), PN_LINK_FLOW);
        }
    }
}
Example #11
0
void create() {
  seteuid(getuid());
  ::create();
  set("short", "Frank");
  enable_commands();
  set("long", @ENDLONG
This is Frank.  Frank is a 7ft. tall human.  Frank is not happy.  
Frank wants you to try somthing.
ENDLONG
  );
  set_name("frank");
  set("id", ({
    "frank",
    "Frank",
    "human",
  }));
	set_alignment(-10);
  arm(WEAPONS(lallai), "dagger");
  credit(380 );
  set("weapon_name", "dagger");
  wear( ARMOR(bshield), "shield");
  set("damage", ({10, 15 }) );
Example #12
0
bool executeCommand(sqlite3 *db, const char *command)
{
    char **params;
    int paramsCount;
    int i;

    int from, to;
    double sum;

    (void)db;   // unused


    // parse command
    paramsCount = countWords(command);
    params = malloc(sizeof(char*) * paramsCount);
    for (i=0; i<paramsCount; i++)
        params[i] = getWord(command, i);            

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_HELP)))
        commandHelp();

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_1)))
        command1();

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_2)))
        command2();

    if ((paramsCount >= 4) && (!strcmp(params[0], COMMAND_TRANSF)))
    {
        sscanf(params[1], "%i", &from);
        sscanf(params[3], "%lf", &sum);
        sscanf(params[2], "%i", &to);
        //transfer(db, from, to, sum);
        if (sum < 0 ) return false;
        debit(db, from, sum);
        credit(db, to, sum);
    }

    if ((paramsCount >= 3) && (!strcmp(params[0], COMMAND_DEB)))
    {
        sscanf(params[1], "%i", &from);
        sscanf(params[2], "%lf", &sum);
        if (sum < 0 ) return false;
        debit(db, from, sum);
    }

    if ((paramsCount >= 3) && (!strcmp(params[0], COMMAND_CRED)))
    {
        sscanf(params[1], "%i", &to);
        sscanf(params[2], "%lf", &sum);
        if (sum < 0) return false;
        credit(db, to, sum);
    }

    if ((paramsCount >= 2) && (!strcmp(params[0], COMMAND_CHCK)))
    {
        sscanf(params[1], "%i", &to);
        checkAccount(db, to);
    }

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_UNDO)))
        undo(db);

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_ADD)))
        createNewCustomer(db);

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_DEL)))
        deleteCustomer(db);

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_DELACC)))
        deleteAccount(db);

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_ADDACC)))
        addAccount(db);

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_COMMIT)))
        commit(db);

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_SHOW)))
        showAll(db);

    if ((paramsCount >= 1) && (!strcmp(params[0], COMMAND_LOGGER)))
        logger(db);

    for (i=0; i<paramsCount; i++)
        free(params[i]);
    free(params);

    return true;
}
Example #13
0
void transfer(sqlite3 *db, int acc_from, int acc_to, double sum)
{
    debit(db, acc_from, sum);
    credit(db, acc_to, sum);
    //credit(db, acc_to, sum);
}
Example #14
0
int main(void)
{
	int userInput = mainMenu;
	rootPointer RP = { NULL, NULL };
	member * leafNull;

	leafNull = (member *)malloc(sizeof(member)* 1);
	leafNull->color = black;
	
	leafNull = makeTree(&RP, leafNull);

	PlaySound(TEXT("bgm.wav"), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP | SND_NODEFAULT);
	while (1)
	{
		fflush(stdin);
		switch (userInput){
		case (mainMenu) :
			userInput = printMain();
			break;
		case (printMemberListInIdOrder) :
			system("cls"); //id 순으로 회원보기
			userInput = printList(RP.rootNode, leafNull);
			break;
		case (registerNewMember) : //회원등록하기
			system("cls");
			userInput = addData(&RP, leafNull);
			break;
		case (searchMember) : //회원검색하기
			system("cls");
			userInput = selectSearch(&RP, leafNull);
			break;
		case (deleteMember) : //삭제하기
			system("cls");
			userInput = selectSearch(&RP, leafNull);
			break;
		case (memberInfoModif) : //수정하기
			system("cls");
			userInput = selectSearch(&RP, leafNull);
			break;
		case (saveMemberList) : //저장하기
			system("cls");
			userInput = saveData(&RP, leafNull);
			break;
		case (quitProgram) : //종료하기 전에 저장여부 확인
			system("cls");
			userInput = askSave(&RP,leafNull);
			return 0;
		case (creditPage) : //credit
			system("cls");
			userInput = credit();
			PlaySound(TEXT("bgm.wav"), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP | SND_NODEFAULT);
			break;
		case (printMemberListInNameOrder) : //이름순으로 회원보기
			system("cls");
			userInput = printList(RP.rootNodeN, leafNull);
			break;
		}
	}

	return 0;
}
Example #15
0
double Rawdata::totalcredit(){
return 	credit() + newcredit();
}
Example #16
0
void main()
{
	int sss,q,ll,gd=DETECT,p,gm,area,a=(450-(50*5)),d,cat=77,ch,dh,eh,t1,t2,t12,t22,len,cc,hh;
	char *str,*str1,*tim;
	initgraph(&gd,&gm,"");
	p=1;
	front();
	dr:
	viewport();
	q=menu();
	if(q==3)
	{
	     arun:	hh=help();
		if(hh==1)
		{
			how();
			goto arun;
		}
		if(hh==2)
		{
			select();
			goto arun;
		}
		if(hh==3)
		{
			credit();
			goto arun;
		}
		if(hh==4)
		{
			design();
			goto arun;
		}
		if(hh==5)
			goto dr;
	}
	if(q==2)
	{
	 rr:
		ll=sivakumar();
	       if(ll==1)
	       {
			p=m2();

			goto rr;
	       }
	       if(ll==2)
	       {
			a=speed();
			viewport();
			goto rr;
	       }
	       if(ll==3)
	       {
			topscore();
			goto rr;
		}
	       if(ll==4)
		    goto dr;
	}
	if(q==4)
		exit(0);
      if(q==1)
      {
	names();
	hide();
	viewport();
	x[0]=85;
	x[1]=70;
	x[2]=55;
	x[3]=40;
	y[0]=y[1]=y[2]=y[3]=35;
	setcolor(4);
	rectangle(24,19,626,396);
	ra();
	setcolor(15);
	setfillstyle(1,10);
	bar(32,32,43,43);
	area=imagesize(30,30,45,45);
	buff=malloc(area);
	getimage(30,30,45,45,buff);
	putimage(30,30,buff,XOR_PUT);
	setpos(0,0);
	setfillstyle(1,0);
	bar(100,100,500,350);
	prakash(p);
	level=p;
	putimage(40,35,buff,XOR_PUT);
	putimage(55,35,buff,XOR_PUT);
	putimage(70,35,buff,XOR_PUT);
	putimage(85,35,buff,XOR_PUT);
	textcolor(GREEN+BLINK);
	len=0;
	status("Game Play: Arrow keys       Menu: Esc         Pause (or) Play: Others key");
	while(1)
	{

	sss=getpixel(5,5);
	if(sss!=0);
	{
		setfillstyle(SOLID_FILL,0);
		bar(0,0,15,15);
	}
		if(((i-4)%11==0)&&(bon==0)&&(len!=(i-4)))
		{
			len=(i-4);
			gettime(&t);
			bonous();
				bon=1;
			t1=t.ti_sec;
			cc=10;
		}
		gettime(&t);
		if((t1!=t.ti_sec)&&(bon==1))
		{
			cc--;
			t1=t.ti_sec;
			itoa(cc,tim,10);
			setfillstyle(SOLID_FILL,0);
			bar(470,0,530,18);
			outtextxy(500,0,tim);

		}
		if((cc==0)&&(bon==1))
		{
			putimage(xc1,yc1,f2,XOR_PUT);
			bar(470,0,530,18);
			bon=0;
		}
		gotoxy(68,1);
		setcolor(6);
	       itoa(score,str,10);
	       setfillstyle(1,0);
	       settextstyle(3,0,1);
	       if(strcmp(str,str1)!=0)
	       {    bar(80,400,350,450);
		    outtextxy(100,420,"Score : ");
		    outtextxy(180,420,str);
		    strcpy(str1,str);
	       }
		if(kbhit())
		{
		       //	ch=getch();
			dh=getch();
			cat=dh;
		}
		else
		{
			arrange(x,y,i);
			if(set==0)
				food();
			if(cat!=dupli)
				cat=lock(cat,dupli);
			switch(cat)
			{
				case 72:
					     if(y[1]==20)
						  y[0]=380;
					     else
						  y[0]=y[1]-15;
					     x[0]=x[1];
					     d=getpixel(x[0]+8,y[0]+8);
					     if((d==10)||(d==14))
						doctor();
					     if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
					     else if(d==15)
					     {
						i++;
						set=0;
						sound(800);
						delay(40);
						score+=bb;
						nosound();
						putimage(x[0],y[0],buff,XOR_PUT);
					     }
					     else
					     {
						 putimage(x[0],y[0],buff,XOR_PUT);
						 putimage(x[i-1],y[i-1],buff,XOR_PUT);
					     }
						delay(a);
				     break;
				case 80:
				     if(y[1]==380)
					  y[0]=20;
				     else
					  y[0]=y[1]+15;
				     x[0]=x[1];
				      d=getpixel(x[0]+8,y[0]+8);
				      if((d==10)||(d==14))
					doctor();
					     if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
				      else if(d==15)
					     {
						i++;
						score+=bb;
						sound(800);
						delay(40);
						set=0;
						nosound();
						putimage(x[0],y[0],buff,XOR_PUT);
					     }
				       else
				      {
					     putimage(x[0],y[0],buff,XOR_PUT);
					     putimage(x[i-1],y[i-1],buff,XOR_PUT);
				      }
				     delay(a);
				     break;
				case 75:
				     if(x[1]==25)
					  x[0]=610;
				     else
					  x[0]=x[1]-15;
				     y[0]=y[1];
				     d=getpixel(x[0]+8,y[0]+8);
					if((d==10)||(d==14))
						doctor();
					     if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
					else if(d==15)
					  {
						i++;
						sound(800);
						delay(40);
						set=0;
						nosound();
						score+=bb;
						putimage(x[0],y[0],buff,XOR_PUT);
					  }
					  else
					  {
					     putimage(x[0],y[0],buff,XOR_PUT);
					     putimage(x[i-1],y[i-1],buff,XOR_PUT);
					  }
				      delay(a);
				 break;
				case 77:
				     if(x[1]==610)
					  x[0]=25;
				     else
					  x[0]=x[1]+15;
				     y[0]=y[1];
				     d=getpixel(x[0]+8,y[0]+8);
				      if((d==10)||(d==14))
					doctor();
					    if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
					else if(d==15)
					    {
						i++;
						set=0;
						sound(800);
						delay(40);
						score+=bb;
						nosound();
						putimage(x[0],y[0],buff,XOR_PUT);
					     }
					     else
					     {
						     putimage(x[0],y[0],buff,XOR_PUT);
						     putimage(x[i-1],y[i-1],buff,XOR_PUT);
					     }
				       delay(a);
					break;
				case 27:
					goto dx;
				//	break;
			}
			dupli=cat;
		}
    }
     }
     dx:
     call();
}