示例#1
0
文件: tp21.c 项目: ulricheza/Isima
int main(int argc, char * argv[])
{
/*declaration des variables*/   
   int i;
   int ** grille = (int**)malloc(N*sizeof(int *));
 /*int ** reservation = (int**)malloc(N*sizeof(int *));*/
   int * remplissage = (int*)malloc(sizeof(int));
   int temp;
   int res = 0;
/* fin des declarations*/
   *remplissage = 0;
   for(i=0;i<N;i++)
      grille[i]=(int *)malloc(N*sizeof(int));
   printf("*****SUDOKU*****\n");
   temp = initialiser(grille);
 /*temp = initialiser(reservation);*/
   generer(grille,remplissage);
   printf("remp=%d\n",*remplissage);
   afficher(grille);
   while(res==0)
   {
      saisir(grille,remplissage);
      afficher(grille);
      printf("remp=%d\n",*remplissage);
      if(*remplissage == 81)
         res=verif_grille(grille);
   }
   printf("Bravo,reussi\n");
   return 0;
}
示例#2
0
//OK
// Affichage en préordre. On affiche le sous arbre gauche puis la racine puis le sous arbre droit
void afficher(Arbre* racine)
{
    if(racine!=NULL)
    {
        afficher(racine->gauche);
        
        printf("%d;",racine->valeur);
        
        afficher(racine->droit);
    }
}
示例#3
0
/**
 * @brief Affiche un puzzle
 * @param[in,out] p le Puzzle à afficher
 * @param[in,out] os le flux de sortie où afficher
 */
void afficher(Puzzle& p, std::ostream& os) {
	os << "*** LEE - long : " << longueur(p.lEE) << endl;
	for (unsigned int i = 0; i < longueur(p.lEE); ++i) {
		afficher(lire(p.lEE, i), os);
		os << endl;
	}
	os << endl << "*** LEAE - long : " << longueur(p.lEAE) << endl;
	for (unsigned int i = 0; i < longueur(p.lEAE); ++i) {
		afficher(lire(p.lEAE, i), os);
		os << endl;
	}
}
示例#4
0
void main(void)
{
  char pgm[] = "4321ud";
  char c;
  int i;
  int r1,r2;

  printf("    ");
  afficher();
  printf("\n");
  for(i=0; pgm[i] != '\0'; i++) {
    c = pgm[i];
    switch (c) {
    case '+':
      r1 = pop();
      r2 = pop();
      push(r2+r1);
      break;
    case '-':
      r1 = pop();
      r2 = pop();
      push(r2-r1);
      break;
    case '*':
      r1 = pop();
      r2 = pop();
      push(r2*r1);
      break;
    case '/':
      r1 = pop();
      r2 = pop();
      push(r2/r1);
      break;
    case 's':
      swap();
      break;
    case 'd':
      down();
      break;
    case 'u':
      up();
      break;
    default:
      if ('0' <= c && c <= '9')
        push(c - '0');
    }
    printf("%c : ",c);
    afficher();
    printf("\n");
  }
}
示例#5
0
/*!
 * \brief Constructeur du menu initial de gestion des UVs.
 */
Debut::Debut() {
    this->setWindowTitle(QString("Operation choisie sur les UVs ?"));
    liste=new QComboBox;
    update();
    ajouter=new QPushButton("Ajouter une UV", this);
    consulter=new QPushButton("Consulter les informations sur cette UV", this);
    modifier=new QPushButton("Modifier des informations sur cette UV", this);
    sup=new QPushButton("Supprimer cette UV", this);
    terminer=new QPushButton("Opérations sur les UVs terminées", this);

    coucheH1=new QHBoxLayout;
    coucheH1->addWidget(liste);

    coucheH2=new QHBoxLayout;
    coucheH2->addWidget(consulter);
    coucheH2->addWidget(sup);
    coucheH2->addWidget(ajouter);
    coucheH2->addWidget(modifier);
    coucheH2->addWidget(terminer);

    coucheV=new QVBoxLayout;
    coucheV->addLayout(coucheH1);
    coucheV->addLayout(coucheH2);
    setLayout(coucheV);

    QObject::connect(ajouter, SIGNAL(clicked()), this, SLOT(ajout()));
    QObject::connect(sup, SIGNAL(clicked()), this, SLOT(suppression()));
    QObject::connect(modifier, SIGNAL(clicked()), this, SLOT(modif()));
    QObject::connect(consulter, SIGNAL(clicked()), this, SLOT(afficher()));
    QObject::connect(terminer, SIGNAL(clicked()), this, SLOT(fin()));
}
示例#6
0
void *threadC(void *inutilise)
{
	afficher(150,'C');
	printf("\n Fin du thread C\n");
	fflush(stdout);
	pthread_exit(NULL);
}
示例#7
0
void *threadA(void *inutilise)
{
	afficher(100,'A');
	printf("\n Fin du thread A\n");
	fflush(stdout);
	pthread_exit(NULL);
}
示例#8
0
Pile::Pile(QLabel * aff)
{
    affichage = aff;
    tpile = std::stack<Constante*>();

    afficher(tpile);
}
void vector_print_n(const vector_t *v, void (*afficher)(const void *), int n){
    int fin = (int)v->size < n ? (int)v->size : n;
    
    for (int i = 0; i < fin; i++) {
        afficher(v->data[i]);
    }
}
示例#10
0
文件: td5exo6.c 项目: tbourg/perso
int main()
{
 int tablo[10], *pt;
 srand(time(NULL));
 pt=tablo;
 printf("taille tablo = %d\ntaille pt = %d\n", sizeof(tablo), sizeof(pt));
 remplir(tablo,10);
 afficher(tablo, 10);
 remplir2(tablo,10);
 afficher2(tablo, 10);
 remplir(pt,10);
 afficher(pt, 10);
 remplir2(pt,10);
 afficher2(pt, 10);
 return 0;
}
示例#11
0
void afficher(const Arbre arbre) {
	Cell* cous = a;
	if(!estVide(a)) {
		affiche(a->gauche);
		printf("%d", a->racine);
		afficher(a->droite);
	} 
}
示例#12
0
文件: main.c 项目: slydevis/Polytech
void afficher(t_ptr_liste liste) {
    if(est_vide(liste)) {
        printf("NULL\n");    
        return;
    }
    
    printf("%d, ", liste->value);
    return afficher(liste->next);
}
示例#13
0
void display(byte add, char success[], char unknow_error[]){
	char hexa[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
	int low_add = add & 0b00001111;
	int high_add = add >> 4;
	if(success[add] && unknow_error[add]){
		afficher(0,1,"ERROR at 0x%c%c",hexa[high_add], hexa[low_add]);
	}
	else if(success[add]){
		afficher(0,1,"device at 0x%c%c",hexa[high_add], hexa[low_add]);
	}
	else if (unknow_error[add]){
		afficher(0,1,"error at 0x%c%c",hexa[high_add], hexa[low_add]);
	}
	else{
		afficher(0,1,"no device: 0x%c%c",hexa[high_add], hexa[low_add]);
	}

}
示例#14
0
void Intro::run(sf::RenderWindow &app)
{
	int i = 0;
	int j = 25;
	int pressCpt = 50;

	std::list<Dir> list_direction = {HAUT, BAS, GAUCHE, DROITE, BAS};

	while(!(sf::Keyboard::isKeyPressed(sf::Keyboard::Return)))
	{
		if(i < 500)
		{
			sf::FloatRect rect = texte_.getLocalBounds();
			texte_.setPosition(sf::Vector2f((Propriete::Fenetre::fenX() - rect.width) / 2, (Propriete::Fenetre::fenY() - Propriete::Fenetre::hauteurSol() - rect.height/2 -500 + i )));
			i++;
		}

		if(perso_->getPosition().x < bat_.getPositionPorte().x)
		{
			perso_->deplacer(DROITE, 2.);
		}
		else if(!list_direction.empty())
		{
			if(j == 25)
			{
				perso_->setDir(list_direction.front());
				list_direction.pop_front();
				j = 0;
			}
			else
			{
				j++;
			}
		}

		if(pressCpt > 0)
		{
			press_.setCharacterSize(40 - pressCpt/4);
		}
		else if(pressCpt > -50)
		{
			press_.setCharacterSize(40 + pressCpt/4);
		}
		else
		{
			pressCpt = 50;
		}

		
		sf::FloatRect pressRect = press_.getLocalBounds();
	press_.setPosition(sf::Vector2f((Propriete::Fenetre::fenX() - pressRect.width) / 2, ((Propriete::Fenetre::fenY() + Propriete::Fenetre::hauteurSol()) / 2) - pressRect.height));

		pressCpt --;
		afficher(app);
	}
}
void Chiffres::jouer()
{
	//test();
	tirerNombres();
	afficher();
	std::cout << std::endl;
	etapeGenerique(_nombres, NOMBRE_NOMBRES);
	afficherResultats();

}
示例#16
0
文件: graph.c 项目: Mialus/M1
void affichage(Graph gr){
    int i;
    
    for(i = 0; i < gr->nbMaxSommets; ++i){
        if(gr->listeVoisin[i] != NULL){
            printf("%i : ",i);
            afficher(gr->listeVoisin[i]);
        }
    }
}
示例#17
0
void *threadB(void *inutilise)
{
	pthread_t thC;
	pthread_create(&thC, NULL, threadC, NULL);
	afficher(100,'B');
	printf("\n %s() : Le thread B attend la fin du thread C\n",__FUNCTION__);
	pthread_join(thC,NULL);
	printf("\n Fin du thread B\n");
	fflush(stdout);
	pthread_exit(NULL);
}
示例#18
0
//fonction pour le remplissage de la matrice de façon par l'utilisateur
void remplissage_par_utilisateur(char **mat){
	printf("%s %d\n",matp,n );
	int iter=0,i,j;
	for (i = 0; i < n; ++i){
		for (j = 0; j < n; j++)		
		{	
			mat[i][j]=matp[iter];
			iter++;
		}
	}
	afficher(mat);
}
示例#19
0
Pile::Pile(QLabel * aff, QRadioButton * _btEntier,QRadioButton * _btRationnel,QRadioButton * _btDegre,QCheckBox * _btComplexe, int max):
    affichage(aff),
    btEntier(_btEntier),
    btRationnel(_btRationnel),
    btDegre(_btDegre),
    btComplexe(_btComplexe),
    posCommande(0),
    executionCommande(0)

{
    afficher(max);
}
示例#20
0
int main (int argc, char *argv[])
{
	struct Matrice m;
	struct Matrice I;
	int i;

	initialiser(&m);

	m.contenu[3][1] = 9.0;
	m.contenu[7][19] = 3.0;
	afficher(&m);

	// Creer la matrice Identite
	for (i = 0; i < 20; i++) {
		I.contenu[i][i] = 1.0;
	}

	multiplier(&m, &I, &m);
	afficher(&m);

	return 0;
}
示例#21
0
//Programme principal
int main()
{
    int i;
    int **matrice;
    matrice = malloc(TAILLE*sizeof(int*));
    for (i = 0; i < TAILLE; ++i)
        matrice[i] = malloc (sizeof(int)*TAILLE);

    //Il faudrait vérifier si l'allocation dynamique s'est bien déroulée


    srand (time(NULL));

    printf("Bienvenue dans le Jeu De La Vie ! Appuyez sur 'Entrer' pour commencer...\n");
    getchar();


    initialiser(matrice);

    printf("La population au départ : \n");
    afficher(matrice);
    printf("\nPressez sur ENTER pour continuer...\n");
    getchar();



    for(i=0; i<CYCLE; i++)
    {

        modifierMatrice(matrice);
        printf("La population après %d cycles: \n",i+1);
        afficher(matrice);
        printf("Pressez sur ENTER pour continuer...\n");
        getchar();
    }

    printf("Nombre de cycle terminé\n");
    return 0;
}
void Exterieur::start(sf::RenderWindow &app)
{
	(*Kurt)->setPosition(sf::Vector2f(-100, (*Kurt)->getPosition().y), DROITE);

	while((*Kurt)->getPosition().x < 50)
	{
		update();
		(*Kurt)->deplacer(DROITE, (*Kurt)->getVitesse());
		app.clear(sf::Color::Black);
		afficher(app);
		app.display();
	}
}
示例#23
0
int main() {
	int k;
	Liste_proc processus = NULL;
	
	// Créer un premier processus
	inserer(99, PRET, &processus);
	
	// Créer 10 processus dans la liste
	for(k = 0; k < 10; k++){
		inserer(k, PRET, &processus);
	}
	
	// Afficher la liste de processus
	afficher(processus);
	
	// Modifier l'état des processus 1, 4, 7
	modifierEtat(1, SUSPENDU, processus);
	modifierEtat(4, SUSPENDU, processus);
	modifierEtat(7, SUSPENDU, processus);
	
	// Afficher à nouveau la liste de processus
	afficher(processus);
	
	// Afficher le pid du premier processus
	printf("Le processus en tête a pour pid %d\n\n", lireNumTete(processus));
	
	// Supprimer le processus 5
	supprimer(5, &processus);
	
	// Dire si les processus 99, 5, 7, 13 appartiennent aux processus listés
	printf("%d : 99 est dans la liste des processus (1=true, 0=false)\n\n", appartient(99, processus));
	printf("%d : 5 est dans la liste des processus (1=true, 0=false)\n\n", appartient(5, processus));
	printf("%d : 7 est dans la liste des processus (1=true, 0=false)\n\n", appartient(7, processus));
	printf("%d : 13 est dans la liste des processus (1=true, 0=false)\n\n", appartient(13, processus));
	
	return 0;
}
示例#24
0
文件: main.c 项目: 0x010C/cclock
void modele1(int h, int m, int s, int c1, int c2)
{
	if(c1%2 == 1)
		attron(A_BOLD);
	else
		attroff(A_BOLD);
	attron(COLOR_PAIR(1+c1-(c1%2)));

	afficher(h/10,-10);
	afficher(h%10,-5);
	afficher(m/10,+2);
	afficher(m%10,+7);

	mvprintw(HEIGHT+2,MIDDLE,"#");
	mvprintw(HEIGHT+4,MIDDLE,"#");

	if(c2%2 == 1)
		attron(A_BOLD);
	else
		attroff(A_BOLD);
	attron(COLOR_PAIR(1+c2-(c2%2)));

	afficherSec(s);
}
示例#25
0
文件: ex4.c 项目: phepthanthong/ASR2
/*
void MinMax(int *tab[], int taille, int * max, int * min) {
  max = tab;
  min = tab;
  int i;
  for (i = 1 ; i < taille ; i++) {
    if (*max < *tab[i])
      max = &tab[i];
    if (*min > *tab[i])
      min = &tab[i];

  }
}
*/
int main()
{
  int taille,i;
  int max,min;
  int *tab;
  printf("Entrez la taille ?");
  scanf("%i",&taille);
  saisir(&tab,taille);
  // for(i=0; i<taille; i++)
  // printf("%i\n",tab[i]);
  afficher(&tab,taille);
  //int ptrmin;
  //ptrmin = Minimum(tab,taille);
  //MinMax(tab,taille,max,min);
  //printf("%i\n",Minimum(tab,taille));
  return 0;
}
示例#26
0
//fonction qui initialise la taille de la matrice , le nom du fichier dictionnaire et le nom du fichier dict.txt 
void initialisation(char **mat){
	FILE* f;
	int k=0,i =0,j;
	char c;
	char * fichier_prob=malloc(30*sizeof(char));
	char * ch=malloc(30*sizeof(char));
	matp=(char*)malloc(30*sizeof(char));
	dict_txt=(char*)malloc(30*sizeof(char));
	
	printf("Donnez le fichier des inputs \n");
	scanf("%s",fichier_prob);

	f=fopen(fichier_prob,"r");
	fgets(ch,30,f);
	fgets(ch,30,f);
	strncpy(dict_txt,ch,strlen(ch)-2);
	printf("%s\n",dict_txt );

	while((!feof(f))&&(i<n)){
		fgets(ch,30,f);
		
		for (j = 0; j < n; j++)		
		{	if (((int)ch[j]>='A')&&((int)ch[j]<=(int)'Z'))
			{
				int x=(int)ch[j]+((int)'a'-(int)'A');
				ch[j]=(char)x;
			}
			matp[k]=ch[j];
			k++;
		}
		i++;
	}
	matp[strlen(matp)]='\n';
	
	int iter=0;
	for (i = 0; i < n; ++i){
		for (j = 0; j < n; j++)		
		{	
			mat[i][j]=matp[iter];
			iter++;
		}
	}
	afficher(mat);
	free(ch);
	close(f);
}
示例#27
0
文件: Jeu.cpp 项目: kwillup7d/Projet
void Jeu::tourJoueur(Joueur* j){
    pair<Joueur*,int> pairetmp;


    cout << "debut du tour." << endl;
    Case* ct;
    Case* tmp;
    //on rajoute un au compteur de jouer du joueur
    j->setJouer(j->getJouer()+1);
    //s'il peut jouer et qu'il n'a pas gagné, on lance son tour
    while((j->getJouer())>0 && !joueurAGagne(j)){
        int choix = j->choixPions();
        pairetmp = make_pair(j,choix);
        //Le joueur fait son choix de pions et on vérifie que c'est vraiment un pion et qu'il n'est pas en fin
        //Ici, le joueur peut choisir 0 s'il veut choisir après le lancer de dé
        while(choix<0 || choix>j->getNombrePions() || (choix!=0 && plateau.estEnFin(placementpions.find(pairetmp)->second))){
            choix = j->choixPions();
            pairetmp = make_pair(j,choix);
        }
        int lancer = j->choixDeplacement();
        cout << "le lancer vaut " << lancer << endl;
        //Si le joueur n'a toujours pas fait son choix, on lui redemande de choisir
        while(choix<1 || choix>j->getNombrePions() || plateau.estEnFin(placementpions.find(pairetmp)->second)){
            choix = j->choixPions();
            pairetmp = make_pair(j,choix);
        }

        ct = placementpions.find(pairetmp)->second;
        //une fois la case du pions trouvée, on fait avancer le pion
        tmp = j->avancerPion(ct, lancer);
        //on enlève un pion à l'ancienne case
        ct->setNombrePions(ct->getNombrePions()-1);
        //on supprime le lien entre pion et case pour créer le nouveau lien
        placementpions.erase(placementpions.find(pairetmp));
        placementpions.insert(make_pair(pairetmp,tmp));
        //on rajoute un pion à la nouvelle case
        tmp->setNombrePions(tmp->getNombrePions()+1);
        cout << "le pion est à la case " << tmp->getNumeroCase() << endl;
        cout << "peut-il rejouer ? " << j->getJouer() << endl;

        string k;
        afficher();
        getline(cin,k);

    }
}
示例#28
0
文件: Conteneur.cpp 项目: congiohj/s3
const T & Conteneur<T>::choisirElement() {
	NombreContraint<int> n(1, 1, m_contenu.size());
	bool ok;
	do{
		try{
			afficher(cout);
			cout << endl << "Choix : ";
			n.saisir(cin);
			ok= true;
		}
		catch(const char *e){
			cout << "Choix entre 1 et " << m_contenu.size() << endl;
			ok = false;
		}
	}while(!ok);
	return (*m_contenu[n.getVal() -1]);

}
示例#29
0
//déclarations des couleurs
//déclaration de variables globales éventuellement
int main(int argc, char ** argv)
{
	//déclaration des variables locales
	SDL_Init(SDL_INIT_VIDEO);
	screen=SDL_SetVideoMode(900,900,32, SDL_HWSURFACE|SDL_DOUBLEBUF);
	
	char lettreFin;
	int i_choixCouleur, i_posX, i_posY, i_width, i_length;
	
	// Initialisation variables
	i_choixCouleur = 0;
	i_posX = 0;
	i_posY = 0;
	i_width = 100;
	i_length = 100;

	// Initialisation fonctions Dessin SDL
	/* exemples de couleurs avec leurs trois composantes RGB */
	couleur[1]=SDL_MapRGB(screen->format,255,255,255); /** white */
	couleur[3]=SDL_MapRGB(screen->format,255,0,0);/** red */
	couleur[5]=SDL_MapRGB(screen->format,0,250,0); /** green */
	couleur[2]=SDL_MapRGB(screen->format,0,0,0); /** black */
	couleur[6]=SDL_MapRGB(screen->format,94,110,40); /** green soft */

	//drawFullRect(screen, i_posX, i_posY, i_width, i_length, i_choixCouleur);
	//
	SDL_FillRect(screen,0,couleur[6]); /* nune seul fenetre peut etre crée, a mettre dans le main*/
	SDL_Flip(screen);
	/* donne un fond green soft à la fenêtre */
	//..... mettre ici le programme concerné
	//tracePlateauCaseTransparante(screen, 0, 0, 8, 800, 800, 255);
	// initialisation debut jeu
	initgrille();
    addgrille(3,3,noire);
    addgrille(4,4,noire);
    addgrille(4,3,blanc);
    addgrille(3,4,blanc);
    // affichage plateau depart
      afficher(screen);
      SDL_Flip(screen);
      pause();
	SDL_Flip(screen);
	return 0;
}
示例#30
0
//Afficher un mot dans un tableau d'enregistrement 
void afficher_le_mot_dans_mat(liste *listeloc_ici, int nliste,char **matt){
	point *p;
	int i,j,nmat=n;
	
	for (i = 0; i < nmat; ++i){
		for (j = 0; j < nmat; ++j)
		{
			matt[i][j] ='*';
		}
	}
	for ( i = 0; i < nliste; ++i)
	{
		p=(listeloc_ici+i)->ensemble;
		for (j = 0; j < (listeloc_ici+i)->nbpoint; ++j)
		{
			*(*(matt+(p+j)->x)+(p+j)->y) =(listeloc_ici+i)->nom;
		}		
	}
	afficher(matt);
}