extrait= combiJoueur2.substr(i,1);//extrait une lettre de la combinaison du joueur 2
if (extrait==essaisJoueur1.substr(i,1)
char c <qqchose>; if (c essaisJoueur1[i]) ...
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questiona ok, parce que mes profs mon dit que 'lon pouvais en metr que &.
std::list<char> bienplace; std::list<char> malplace; const int size1 = combiJoueur1.size(); const int size2 = combiJoueur2.size(); for (int i = 0; i < size1; ++i) { const char current = essaisJoueur1[i]; if (i < size2 && combiJoueur2[i] == current) { bienplace.push_back(essaisJoueur1[i]); } else { for (int j = 0; j < size2; ++j) { if (current == combiJoueur2[j] && i != j) { malplace.push_back(essaisJoueur1[i]); } } } }
oula ! euh j'ai pas encore vu ça en cours, c'est quoi push_back
ou encore current ?
peut tu me dires si le code suivant est juste:
#include <stdio.h> #include <stdlib.h> /*! ** Get a random number between from and to ** ** @param from Range begin ** @param to Range end ** ** @return A random number */ int rangeRand(int from, int to) { return rand () % (to - from + 1) + from; } int main(void) { char c; srand(time(NULL)); c = rangeRand('a', 'z'); printf("%c\n", c); return 0; }
#include <cstdlib> #include /*! ** Get a random number between from and to ** ** @param from Range begin ** @param to Range end ** ** @return A random number */ int rangeRand(int from, int to) { return rand () % (to - from + 1) + from; } int main(void) { char c; srand(time(0)); c = rangeRand('a', 'z'); std::cout << c << std::endl; return 0; }