Exemple #1
0
void main()
{
	int i, j, vector1[7], vector2[5], vector3[12], k, numi, numi2;


	printf(" ##### EJERCICIO 4 ##### \n");
	printf("Introduce los datos del primer vector. \n");
	intro(vector1, 7);
	printf("Introduce los datos del segundo vector. \n");
	intro(vector2, 5);
	

	ordena(vector1, 7);
	ordena(vector2, 5);
	
	for(k=0, numi=0, numi2=0; k<12; k++)
	{
		if(numi2>=5 || (numi<7 && vector1[numi]<vector2[numi2]))
		{
			vector3[k]=vector1[numi];
			numi++;
		}
		else
		{
			vector3[k]=vector2[numi2];
			numi2++;
		}
	}
	muestra(vector1, 7);
	muestra(vector2, 5);
	muestra(vector3, 12);

	fflush(stdin);
	getchar();
}
Exemple #2
0
void IntroCode::onSendCall() {
	if (!--waitTillCall) {
		callTimer.stop();
		MTP::send(MTPauth_SendCall(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash())), rpcDone(&IntroCode::callDone));
	}
	update();
}
Exemple #3
0
bool IntroCode::codeSubmitFail(const RPCError &error) {
	stopCheck();
	code.setDisabled(false);
	const QString &err = error.type();
	if (err == "PHONE_NUMBER_INVALID" || err == "PHONE_CODE_EXPIRED") { // show error
		onBack();
		return true;
	} else if (err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID") {
		showError(lang(lng_bad_code));
		code.setFocus();
		return true;
	} else if (err == "PHONE_NUMBER_UNOCCUPIED") { // success, need to signUp
		intro()->setCode(sentCode);
		intro()->onIntroNext();
		return true;
	}
	if (QRegularExpression("^FLOOD_WAIT_(\\d+)$").match(err).hasMatch()) {
		showError(lang(lng_flood_error));
		code.setFocus();
		return true;
	}
	if (cDebug()) { // internal server error
		showError(err + ": " + error.description());
	} else {
		showError(lang(lng_server_error));
	}
	code.setFocus();
	return false;
}
Exemple #4
0
IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent),
    errorAlpha(0), changed(false),
	next(this, lang(lng_intro_next), st::btnIntroNext),
	country(this, st::introCountry),
	phone(this, st::inpIntroPhone), code(this, st::inpIntroCountryCode),
	_signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), st::introErrLabel, st::introErrLabelTextStyle),
    _showSignup(false) {
	setVisible(false);
	setGeometry(parent->innerRect());

	connect(&next, SIGNAL(stateChanged(int, ButtonStateChangeSource)), parent, SLOT(onDoneStateChanged(int, ButtonStateChangeSource)));
	connect(&next, SIGNAL(clicked()), this, SLOT(onSubmitPhone()));
	connect(&phone, SIGNAL(voidBackspace(QKeyEvent*)), &code, SLOT(startErasing(QKeyEvent*)));
	connect(&country, SIGNAL(codeChanged(const QString &)), &code, SLOT(codeSelected(const QString &)));
	connect(&code, SIGNAL(codeChanged(const QString &)), &country, SLOT(onChooseCode(const QString &)));
	connect(&code, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
	connect(&country, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
	connect(&code, SIGNAL(addedToNumber(const QString &)), &phone, SLOT(addedToNumber(const QString &)));
	connect(&phone, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(&code, SIGNAL(changed()), this, SLOT(onInputChange()));
	connect(intro(), SIGNAL(countryChanged()), this, SLOT(countryChanged()));
	connect(&checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));

	_signup.setLink(1, TextLinkPtr(new SignUpLink(this)));
	_signup.hide();

	_signupCache = myGrab(&_signup);

	if (!country.onChooseCountry(intro()->currentCountry())) {
		country.onChooseCountry(qsl("US"));
	}
	changed = false;
}
void IntroPhone::phoneSubmitDone(const MTPauth_SentCode &result) {
	stopCheck();
	enableAll(false);
	
	const MTPDauth_sentCode &d(result.c_auth_sentCode());
	intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.vphone_registered.v);
	intro()->setCallTimeout(result.c_auth_sentCode().vsend_call_timeout.v);
	intro()->onIntroNext();
}
Exemple #6
0
void IntroCode::codeSubmitDone(const MTPauth_Authorization &result) {
	stopCheck();
	code.setDisabled(false);
	const MTPDauth_authorization &d(result.c_auth_authorization());
	if (d.vuser.type() != mtpc_userSelf) { // wtf?
		showError(lang(lng_server_error));
		return;
	}
	cSetLoggedPhoneNumber(intro()->getPhone());
	intro()->finish(d.vuser);
}
Exemple #7
0
void IntroCode::onSubmitCode(bool force) {
	if (!force && (code.text() == sentCode || !code.isEnabled())) return;

	code.setDisabled(true);
	setFocus();

	showError("");

	checkRequest.start(1000);

	sentCode = code.text();
	sentRequest = MTP::send(MTPauth_SignIn(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash()), MTP_string(sentCode)), rpcDone(&IntroCode::codeSubmitDone), rpcFail(&IntroCode::codeSubmitFail));
}
Exemple #8
0
void ram(void) {
	//uint8_t button;
	uint32_t LEDs;
	intro(3);

	// populate my Vector table
	//  add DMB() here, as VTOR updates are NOT effective immediately
	//


	GPIO_GPIO3DIR &= ~1;
	IOCON_PIO3_0 = (1 << 3) | (1 << 5); // Pull DOWN not Up, Hyst on
	GPIO_GPIO3IS &= ~1;
	GPIO_GPIO3IEV |= 1;
	GPIO_GPIO3IE |= 1;
	NVIC_EnableIRQ(EINT3_IRQn);
	//IntCtr = 0;
	LEDs = 0;
	mainloop();

	GPIO_GPIO3IE &= ~1; // disable GPIO IRQ
	NVIC_DisableIRQ(EINT3_IRQn);
	GPIO_GPIO3IC |= (0x01); // ACK BUSINT
	// restore VTOR
}
Exemple #9
0
int main() {

  int nb = 0, continuer = 0;
  char tab[TAB_MAX][TAB_MAX] = {0};
  Joueur joueur1 = {0};
  Joueur joueur2 = {0};
  Joueur ePanda = {0};

  joueur1.x = 2;
  joueur1.y = 1;
  joueur2.x = 47;
  joueur2.y = 48;
  joueur1.ico = 257;
  joueur2.ico = 258;
  ePanda.ico = 153;

  do {
    nb = afficheMenu(tab, &joueur1, &joueur2,
                     &ePanda); // Appel de la fonction d'affichage du menu

    intro(); // Affichage de l'intro
    // system("PAUSE");
    system("cls");
    jeu(tab, &joueur1, &joueur2, &ePanda);
  } while (Quitter() != 1);

  return EXIT_SUCCESS;
}
Exemple #10
0
void Jogo::run()
{
    intro();

    sf::Clock clock;
    gui.clk_esteira.restart();

    geraFila();

    sf::Time timeSinceLastUpdate = sf::Time::Zero;

    score.restart();

    gui.musicaFundo.play();
    while(gui.tela.isOpen() && this->level < 6)
    {
        timeSinceLastUpdate += clock.restart();

        if(timeSinceLastUpdate > timePerFrame)
        {
            processaEventos();
            if(!jogo_paused)
            {
                atualizaEstado();
                desenha();
            }

            timeSinceLastUpdate = sf::Time::Zero;
        }

    }
    encerramento();


}
Exemple #11
0
void Menu::showMenu() {
	cout << endl;
	//cout << " --------------------------------------" << endl;
	cout << " ^*^ Dzien dobry! dzis jest "<< wsk->dat.getDateStamp() <<endl;
	//cout << " --------------------------------------" << endl;
	bool k = true;
	while (k) {
		intro();
		string choice;
		cin >> choice;
		if (choice == "1")
		{
			addInvoice();
		}
		else if (choice == "2"){
			addCompany();
		}
		else if (choice == "3"){
			menuBase();
		}
		else if (choice == "4") {
			menuHistory();
		}
		else if (choice == "0")
		{
			cout << endl << " Do zobaczenia... " << endl;
			k = false;
		}
		else
			cout << " Wybierz poprawnie z podanych opcji... " << endl;
	}
}
/*
 * Main program.
 */
int main() {
    if (RANDOM_USE_SEED) {
        setRandomSeed(106);
    }
    
    intro();

    // create GUI window and position the console to its right
    setConsoleLocation(WorldGrid::WINDOW_WIDTH + 6 * WorldAbstract::WINDOW_MARGIN, 20);   // temporary
    // setConsoleSize(CONSOLE_WIDTH, CONSOLE_HEIGHT);
    setConsoleEventOnClose(true);
    
    TrailblazerGUI gui(WINDOW_TITLE);
    gui.snapConsoleLocation();

    // main event loop to process events as they happen
    while (true) {
        GEvent e = waitForEvent(ACTION_EVENT | MOUSE_EVENT | WINDOW_EVENT);
        if (e.getEventType() == MOUSE_CLICKED || e.getEventType() == MOUSE_MOVED) {
            gui.processMouseEvent(GMouseEvent(e));
        } else if (e.getEventClass() == ACTION_EVENT) {
            gui.processActionEvent(GActionEvent(e));
        } else if (e.getEventClass() == WINDOW_EVENT) {
            gui.processWindowEvent(GWindowEvent(e));
        }
    }
    return 0;
}
Exemple #13
0
void inputSize (US *size) {
    do {
	system("clear");
	intro();
	printf("What size is the suduku?? ");
    } while (validateInput(size,100) == false);   
}
Exemple #14
0
bool IntroPwdCheck::pwdSubmitFail(const RPCError &error) {
	sentRequest = 0;
	stopCheck();
	_pwdField.setDisabled(false);
	_codeField.setDisabled(false);
	const QString &err = error.type();
	if (err == "PASSWORD_HASH_INVALID") {
		showError(lang(lng_signin_bad_password));
		_pwdField.selectAll();
		_pwdField.notaBene();
		return true;
	} else if (err == "PASSWORD_EMPTY") {
		intro()->onIntroBack();
	} else if (mtpIsFlood(error)) {
		showError(lang(lng_flood_error));
		_pwdField.notaBene();
		return true;
	}
	if (cDebug()) { // internal server error
		showError(err + ": " + error.description());
	} else {
		showError(lang(lng_server_error));
	}
	_pwdField.setFocus();
	return false;
}
Exemple #15
0
void IntroCode::paintEvent(QPaintEvent *e) {
	bool trivial = (rect() == e->rect());

	QPainter p(this);
	if (!trivial) {
		p.setClipRect(e->rect());
	}
	if (trivial || e->rect().intersects(textRect)) {
		p.setFont(st::introHeaderFont->f);
		p.drawText(textRect, intro()->getPhone(), style::al_top);
		p.setFont(st::introFont->f);
		p.drawText(textRect, lang(lng_code_desc), style::al_bottom);
	}
	QString callText = lang(lng_code_calling);
	if (waitTillCall >= 3600) {
		callText = lang(lng_code_call).arg(QString("%1:%2").arg(waitTillCall / 3600).arg((waitTillCall / 60) % 60, 2, 10, QChar('0'))).arg(waitTillCall % 60, 2, 10, QChar('0'));
	} else if (waitTillCall > 0) {
		callText = lang(lng_code_call).arg(waitTillCall / 60).arg(waitTillCall % 60, 2, 10, QChar('0'));
	} else if (waitTillCall < 0) {
		callText = lang(lng_code_called);
	}
	p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrHeight), callText, style::al_center);
	if (animating() || error.length()) {
		p.setOpacity(errorAlpha.current());
		p.setFont(st::introErrFont->f);
		p.setPen(st::introErrColor->p);
		p.drawText(QRect(textRect.left(), next.y() + next.height() + st::introErrTop, st::introTextSize.width(), st::introErrHeight), error, style::al_center);
	}
}
Exemple #16
0
// Runs the Game...
void Ultra1::App::Run( )
{
	// All of the game states we could be in...
	Intro intro( this );
	MainMenu menu( this );
	Game game( this );
	MapState map_state( this );
	WonState won( this );
	LostState lost( this );
	HelpState help( this );
	StoryState story( this );
	OptionsState options( this );

	// Must be entered into array in same order as the const values...
	GameState* states[] = { &intro, &menu, &game, &map_state, &won, &lost, &help, &story, &options };

	// We start in the intro...
	StateNumber current_state = INTRO_STATE;

	while( current_state != QUIT_STATE )
	{
		// Run the current state and assign the next state to it...
		current_state = states[current_state]->Run( );
	}
}
Exemple #17
0
void ManicKnights::introduction() {

    // there's a class for that

    Introduction intro(*_panel);
    intro.run();
}
Exemple #18
0
bool IntroPwdCheck::codeSubmitFail(const RPCError &error) {
	sentRequest = 0;
	stopCheck();
	_pwdField.setDisabled(false);
	_codeField.setDisabled(false);
	const QString &err = error.type();
	if (err == "PASSWORD_EMPTY") {
		intro()->onIntroBack();
		return true;
	} else if (err == "PASSWORD_RECOVERY_NA") {
		recoverStartFail(error);
		return true;
	} else if (err == "PASSWORD_RECOVERY_EXPIRED") {
		_emailPattern = QString();
		onToPassword();
		return true;
	} else if (err == "CODE_INVALID") {
		showError(lang(lng_signin_wrong_code));
		_codeField.selectAll();
		_codeField.notaBene();
		return true;
	} else if (mtpIsFlood(error)) {
		showError(lang(lng_flood_error));
		_codeField.notaBene();
		return true;
	}
	if (cDebug()) { // internal server error
		showError(err + ": " + error.description());
	} else {
		showError(lang(lng_server_error));
	}
	_codeField.setFocus();
	return false;
}
Exemple #19
0
int
main(int argc, char *argv[])
{
    if (pledge("stdio rpath tty", NULL) == -1)
        err(1, "pledge");

    do_options(argc, argv);

    intro();
    do {
	initgame();
	while(awinna() == -1)
	{
	    if (!blitz)
	    {
		if (!salvo)
		{
	    	    if(turn)
			(void) cputurn();
		    else
			(void) plyturn();
		}
		else  /* salvo */
		{
		    int i;

		    i = scount(turn);
		    while (i--)
		    {
			if (turn)
			{
			    if (cputurn() && awinna() != -1)
				i = 0;
			}
			else
			{
			    if (plyturn() && awinna() != -1)
				i = 0;
			}
		    }
		}
	    }
	    else  /* blitz */
	    	while(turn ? cputurn() : plyturn())
		{
		    if (turn)   /* Pause between successive computer shots */
		    {
			(void)refresh();
			(void)sleep(1);
		    }
		    if (awinna() != -1)
		     break;
		}
	    turn = OTHER;
	}
    } while
	(playagain());
    uninitgame(0);
    return 0;
}
Exemple #20
0
int main (){
 	signal(SIGINT, sig_handler);
	intro();
 	//myinfo();
	looper();
	
}
Exemple #21
0
int main()
{
    uart_init();
    char in[40]; // input buffer
    while(1)
    {
        if(!gameStarted) 
            intro();
        unsigned int theGuess = randInt(lowerBound, upperBound);
        guess(theGuess);
        read_echo(in);
        if(in[0] == 'h')
            lowerBound = theGuess;
        else if(in[0] == 'l')
            upperBound = theGuess;
        else if(in[0] == 'y')
        {
            printLine("I win");
            gameStarted = 0;
            printLine("press any key to continue...");
            uart_receive();
        }
        else if(isReset(in))
        {
            gameStarted = false;
            printLine("press any key to continue...");
            uart_receive();
        }
   }
}
Exemple #22
0
void Troll::run() {
    while (!_vm->shouldQuit()) {
        intro();
        gameLoop();
        gameOver();
    }
}
Exemple #23
0
funccall::funccall()  // calls other functions...
{
   intro();
   wel();
   pass();
   mmenu();
}
Exemple #24
0
void ledCube8_Game::run()
{
	init();
	intro();
	while(gameIsRunning)
	{
		
		time = millis();
		if((time - startTime) > stopTime)
		{
			stop();
		}
		
		
	but1P1->checkButton();
	but2P1->checkButton();
	but3P1->checkButton();
	but4P1->checkButton();
	but5P1->checkButton();
	but6P1->checkButton();
	
	but1P2->checkButton();
	but2P2->checkButton();
	but3P2->checkButton();
	but4P2->checkButton();
	but5P2->checkButton();
	but6P2->checkButton();
	checkForCollision();
	}
	while(true)
	{
		
	}
}
Exemple #25
0
/****************************************************************************
 *  FUNCTION: main() - local routine                                        *
 ****************************************************************************/
int main(int argc, char *argv[])
    {
    int key_entered, Ch;

    intro();

    /* Set all 16 buffers to 0 */
    for (Ch = 0; Ch < 4; Ch++)
	   OUTPORT(base + (Ch * 2), Cal(0x000, Ch));

    inb(base+0xA);    // set automatic update mode
    inb(base+0XF);    // release zero latch

    do
	{
	CLRSCR();
	write_DAC();
	CPRINTF("\n\nWould you like to output another value (Y or N)?\n");
	key_entered = GETCH();
	} while((key_entered != 'N') && (key_entered != 'n'));

    /* Set all 16 buffers to 0 */
    for (Ch = 0; Ch < 4; Ch++)
	   OUTPORT(base + (Ch * 2), Cal(0x000, Ch));

    CLRSCR();
    PUTS("DA12-16 Sample1 complete.");
    } /* end main */
Exemple #26
0
void Intervalometer::init()
{
	Serial.begin(9600);
    while(!Serial){}
	
	pinMode       (shuterPin,OUTPUT);
	pinMode       (displayPin,OUTPUT);
	pinMode		  (brightnessPin, OUTPUT);
	digitalWrite  (shuterPin,LOW);
	digitalWrite  (displayPin,HIGH);
  
  
	p_lcd-> 					init();
	p_buttonLightUp->  			init();
	p_buttonLightDown->			init();
	p_buttonUp->            	init();
	p_buttonDown->          	init();
	p_buttonOk->            	init();
	p_buttonBack->			 	init();
	p_led->				     	init();
	p_lcd->     createChar(2, kamera);
	p_lcd -> 	createChar(1,PfeilDown);
	p_lcd -> 	createChar(0,PfeilUp);
	
	setLight();
	intro();
	p_lcd->clear();
	
	Serial.println("SETUP DONE");	
}
// Main Function
int editar_produto (void)
{
    int menu_selection = 1;
    
    do
    {
        switch (menu_selection)
        {
            case -1:
                menu_selection = continue_editing();
                break;
                
            case 1:
                intro();
                menu_selection = get_goods_id();
                get_product_info();
                break;
            case 2:
                edit_product_info(get_wich_info_to_edit());
                break;
                
            default:
                return 0;
                break;
        }
    } while (1);
    
    return 0;
}
EquatorialCoordinateGrid::EquatorialCoordinateGrid( SkyComposite *parent )
        : CoordinateGrid( parent, i18n("Equatorial Coordinate Grid" ) )
{
    KStarsData *data = KStarsData::Instance();

    intro();

    double eps    =   0.1;
    double minRa  =   0.0;
    double maxRa  =  23.0;
    double dRa    =   2.0;
    double minDec = -80.0;
    double maxDec =  90.0;
    double dDec   =  20.0;
    double dDec2  =   4.0;
    double dRa2   =   0.2;

    double max, dec, dec2, ra, ra2;

    LineList* lineList;

    for ( ra = minRa; ra < maxRa; ra += dRa ) {
        for ( dec = -90.0; dec < maxDec - eps; dec += dDec ) {
            lineList = new LineList();
            max = dec + dDec;
            if ( max > 90.0 ) max = 90.0;
            for ( dec2 = dec; dec2 <= max + eps; dec2 += dDec2 ) {
                SkyPoint* p = new SkyPoint( ra, dec2 );
                p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
                lineList->append( p );
            }
            appendLine( lineList );
        }
    }

    for ( dec = minDec; dec < maxDec + eps; dec += dDec ) {
        // Do not paint the line on the equator
        if ( dec < 0.1 && dec > -0.1 )
            continue;
        
        // Adjust point density
        int nPoints = int(round( fabs(cos(dec* dms::PI / 180.0)) * dRa / dRa2 ));
        if ( nPoints < 5 )
            nPoints = 5;
        double dRa3 = dRa / nPoints;

        for ( ra = minRa; ra < maxRa + eps; ra += dRa ) {
            lineList = new LineList();
            for ( ra2 = ra; ra2 <= ra + dRa + eps; ra2 += dRa3 ) {
                SkyPoint* p = new SkyPoint( ra2, dec );
                p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
                lineList->append( p );
            }
            appendLine( lineList );
        }
    }
    
    summary();
}
int main(int argc, char** argv)
{
//create an array to hold all your function pointers and populate them
verse verses[13];
verses[0] = NULL;
verses[1] = verse1;
verses[2] = verse2;
verses[3] = verse3;
verses[4] = verse4;
verses[5] = verse5;
verses[6] = verse6;
verses[7] = verse7;
verses[8] = verse8;
verses[9] = verse9;
verses[10] = verse10;
verses[11] = verse11;
verses[12] = verse12;

//with 0 NULL and each verse being the number it corresponds to

 
 
//create a function pointer for the intro
day intro = introduction;
 
//print out the first verse
intro(1);
verses[1]();
    

//change the first verse of the song to newVerse1
verses[1] = newVerse1;
    

//using a 2 loops print the rest of the song
int i,j;
for(i=2;i<13;i++) {
    intro(i);
    for(j=i;j>0;j--) {
        verses[j]();
    }
}
    

return (EXIT_SUCCESS);
} 
Exemple #30
0
void IntroPhone::phoneSubmitDone(const MTPauth_SentCode &result) {
	stopCheck();
	sentRequest = 0;
	enableAll(true);

	if (result.type() != mtpc_auth_sentCode) {
		showError(lang(lng_server_error));
		return;
	}

	const auto &d(result.c_auth_sentCode());
	switch (d.vtype.type()) {
	case mtpc_auth_sentCodeTypeApp: intro()->setCodeByTelegram(true); break;
	case mtpc_auth_sentCodeTypeSms:
	case mtpc_auth_sentCodeTypeCall: intro()->setCodeByTelegram(false); break;
	case mtpc_auth_sentCodeTypeFlashCall: LOG(("Error: should not be flashcall!")); break;
	}
	intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.is_phone_registered());
	if (d.has_next_type() && d.vnext_type.type() == mtpc_auth_codeTypeCall) {
		intro()->setCallStatus({ IntroWidget::CallWaiting, d.has_timeout() ? d.vtimeout.v : 60 });
	} else {
		intro()->setCallStatus({ IntroWidget::CallDisabled, 0 });
	}
	intro()->nextStep(new IntroCode(intro()));
}