void IterateurListe::AjouterAvant(NoeudAbstrait* _n) {
 
 
 	if (Valide()) {
 
 		++liste()->nombreDElements ;
 
 		if (noeudCourant() == liste()->premierNoeud) {
 		// si le noeud courant est le premier noeud
 			
 			_n->suivant = liste()->premierNoeud.Liberer() ;
 			_n->precedent = Association<NoeudAbstrait>() ;
 			liste()->premierNoeud = _n ;
 			_n->suivant->precedent = liste()->premierNoeud ;
 
 		}
 		else 
 		// sinon
 
 			noeudCourant()->AjouterAvant(_n) ;
 
 	} else
 
 		throw ExceptionBase("IterateurListe::add_before") ;
 
 }
示例#2
0
/**
 * @brief Hauptprogramm
 */
int main(int argc, char* argv[])
{
	char *end;
	int z;
	sem_init();
	if(argc > 1)
	{
		if(!strcmp("-l", argv[1]))
		{
			if(argc == 3)
				liste(argv[2]);
			else if(argc == 2)
				liste(NULL);
			else
				rtfm(argv);
		}
		else if(!strcmp("-n", argv[1]))
		{
			if(argc == 4)
				neu(argv[2], argv[3]);
			else
				rtfm(argv);
		}
		else if(!strcmp("-z", argv[1]))
		{
			if(argc == 4)
			{
				z = strtoul(argv[3], &end, 0);
				if(argv[3] == end)
				{
					fprintf(stderr, "%s: Keine Zahl: %s\n", argv[0], argv[3]);
					exit(1);
				}
				zuschlag(argv[2], z);
			}
			else
				rtfm(argv);
		}
		else if(!strcmp("-d", argv[1]))
		{
			if(argc == 3)
				rechnung(argv[2]);
			else
				rtfm(argv);
		}
		else
			rtfm(argv);
	}
	else
	{
		rtfm(argv);
	}
	exit(0);
}
示例#3
0
void main()
{
    int i;
    char c;

    if((fp=fopen("array.dat","r+"))==NULL)
    {
        fp=fopen("array.dat","w+");
    }

    do
    {
        system("cls");
        fseek(fp,0,2); // seek_end =2
        printf("dosya uzunlugu : %d\n",ftell(fp));
        printf("kayit sayisi: %d\n",ftell(fp)/sizeof(int));


     printf("1-Giris\n2-Liste\n3-Cikis\n");
     c=getchar();
     switch(c)
     {
         case '1': giris(); break;
         case '2': liste(); break;
         case '3': exit(0);
     }
    }while(1);




    }
示例#4
0
文件: ex1.c 项目: omlet05/1ti
void	main(void)
{
	char choix;
	liste();
	choix = choisir();
	printf("%c", choix);
	switch(choix)
	{
	case 'A':
		printf("\nLancer Word\n");
		break;
	case 'B':
		printf("\nLancer Excel\n");
		break;
	case 'C':
		printf("\nLancer Access\n");
		break;
	case 'D':
		printf("\nLancer Internet Explorer\n");
		break;
	default:
		printf("\nchoix incorrect\n");
	}

}
 void IterateurListe::AjouterApres(NoeudAbstrait* _n) {
 
 
 	if (Valide()) {
 
 		++liste()->nombreDElements ;
 
 		if (noeudCourant() == liste()->dernierNoeud) {
 		// si le noeud courant est le dernier noeud
 			
 			noeudCourant()->suivant = _n ;
 			_n->precedent = noeudCourant() ;
 			liste()->dernierNoeud = noeudCourant()->suivant ;
 
 		} else 
 		// sinon
 
 			noeudCourant()->AjouterApres(_n) ;
 		
 	} else
 
 		throw ExceptionBase("IterateurListe::AjouterApres") ;
 
 }
 void IterateurListe::Enlever() {
 
 
 	if (Valide()) {
 
 		liste()->nombreDElements-- ;
 
 		// pointeur sur le noeud courant après le remove :
 		Association<NoeudAbstrait> c = noeudCourant()->suivant ;
 
 		// sert à prendre le noeud courant et à la detruire :
 		Composition<NoeudAbstrait> det ;
 
 
 		// 1.on remmet les associations de possession :
 
 		if (noeudCourant() == liste()->premierNoeud) {
 		// si le noeud courant est le premier noeud
 		
 			det = liste()->premierNoeud.Liberer() ;
 			liste()->premierNoeud = noeudCourant()->suivant.Liberer() ;
 
 		} else {
 		// sinon
 
 			det = noeudCourant()->precedent->suivant.Liberer() ;
 			noeudCourant()->precedent->suivant = noeudCourant()->suivant.Liberer() ;
 		}
 
 		// 2.on remmet les associations sur le précédent :
 
 		if (noeudCourant() == liste()->dernierNoeud) 
 		// si le noeud courant est le dernier noeud
 			
 			liste()->dernierNoeud = noeudCourant()->precedent ;
 
 		else 
 		// sinon
 
 			c->precedent = noeudCourant()->precedent ;
 
 
 		// 3.l'ancien suivant est le courant :
 
 		BASE_VREF(noeudCourant) = c ;
 
 
 	} else
 
 		throw ExceptionBase("Iterlist()::remove") ;
 
 }
示例#7
0
main()
{
    struct rehber kisi[30];
    int i;
    char karar;
	for(i=0;i<30;i++)
    {
        kisi[i].doluMu='H';
    }
	while(1==1)
    {
        karar=menu();
		switch(karar)
        {
            case '1': ekle(kisi); break;
            case '2': liste(kisi); break;
            case '3': sil(kisi); break;
            case '4': ara(kisi); break;
        }
    }
}
示例#8
0
void GameState::draw()
{
    float blocSize(mWorld.getBlocSize());
    mContext.window->clear();
    std::vector<Bloc*> liste(mWorld.getListeFixBloc());
    for (unsigned int i=0; i<liste.size(); ++i)
    {
        sf::Sprite sprite;
        sprite.setTexture(mContext.textures->get(liste[i]->getId()));
        b2Vec2 pos(liste[i]->getPos());
        sf::IntRect rect;
        rect.height = 200*blocSize;
        rect.width = 200*blocSize;
        sprite.setTextureRect(rect);
        float x = 100.*(pos.x-blocSize);
        float y = 100.*(pos.y-blocSize);
        sprite.setPosition(x ,y);
        mContext.window->draw(sprite);
    }
    liste = mWorld.getListeDynamicBloc();
    for (unsigned int i=0; i<liste.size(); ++i)
    {
        sf::Sprite sprite;
        sf::Texture texture(mContext.textures->get(liste[i]->getId()));
        sprite.setTexture(texture);
        sf::IntRect rect;
        rect.height = 200*(blocSize);
        rect.width = 200*(blocSize);
        sprite.setTextureRect(rect);
        b2Vec2 pos(liste[i]->getPos());
        float x = 100.*(pos.x-blocSize);
        float y = 100.*(pos.y-blocSize);
        sprite.setPosition(x ,y);
        mContext.window->draw(sprite);
    }
    mContext.window->draw(mPlayerShape);
    mContext.window->display();
}