Aller au contenu
Règlement du forum ×
IPTV et arnaques ×

Probléme Pour Initialiser Mon Tableau


namster

Messages recommandés

Salut,

voila je dois réaliser un jeux du pendu enfin si on peut l'appeler Comme sa :p ,bon le probléme n'est pas la:(,Le code n'est pas encore fini il reste encore du boulot comme vous le voyez j'utillise une boucle Pour Affichier les ***** mais sa ne marche pas et sa me bock un peut pour continuer le programme :mad: cet lorsque je tape une lettre que les *** apparaissent.

#include 
#include 
#include 
#include "pendu.h"

int main()

{
int coupRestant=10;
char MOTsEcret[]="MARRON";
int MotDonner[6]={0};
char lettre=0;
int i=0;
do
{
printf("Bienvenu au Jeux Du Pendu\n");
printf("Il Vous Reste %d \n",coupRestant);
for (i=0;i{
   if(MotDonner[i])
           printf("*");

   else
   printf("%c",MOTsEcret[i]);
}
printf("Proposer Une Lettre : ");
lettre=getlettre();
afficherMot(MOTsEcret,MotDonner,lettre);
coupRestant--;
}while(coupRestant !=0);
system("PAUSE");
return 0;
}

int afficherMot(int MOTsEcret[],int MotDonner[],char lettre)
{
   int i=0;
   do
{
       if(MOTsEcret[i]=lettre)
       {
           MotDonner[i]=1;
       }
       i++;

}while(i}
  char getlettre()
{
   char caractere = 0;
   caractere = getchar();
   caractere = toupper(caractere);
   while (getchar() != '\n') ;
   return caractere;
}



Modifié par namster
Lien vers le commentaire
Partager sur d’autres sites

C'est normal, tu te trompes dans les conditions à l'intérieur de la boucle Pour :

[font=Comic Sans MS][color=#000000][color=#007700]for ([/color][color=#0000BB]i[/color][color=#007700]=[/color][color=#0000BB]0[/color][color=#007700];[/color][color=#0000BB]i[/color][color=#007700]{
   if([/color][color=#0000BB]MotDonner[/color][color=#007700][[/color][color=#0000BB]i[/color][color=#007700]])
           [/color][color=#0000BB]printf[/color][color=#007700]([/color][color=#DD0000]"*"[/color][color=#007700]);

   else
   [/color][color=#0000BB]printf[/color][color=#007700]([/color][color=#DD0000]"%c"[/color][color=#007700],[/color][color=#0000BB]MOTsEcret[/color][color=#007700][[/color][color=#0000BB]i[/color][color=#007700]]);
}[/color][/color][/font]

Lien vers le commentaire
Partager sur d’autres sites

le .c qui va avec

 

J'ai Pas Comprie Kho ?

C'est normal, tu te trompes dans les conditions à l'intérieur de la boucle Pour :

[font=Comic Sans MS][color=#000000][color=#007700]for ([/color][color=#0000BB]i[/color][color=#007700]=[/color][color=#0000BB]0[/color][color=#007700];[/color][color=#0000BB]i[/color][color=#007700]{
   if([/color][color=#0000BB]MotDonner[/color][color=#007700][[/color][color=#0000BB]i[/color][color=#007700]])
           [/color][color=#0000BB]printf[/color][color=#007700]([/color][color=#DD0000]"*"[/color][color=#007700]);

   else
   [/color][color=#0000BB]printf[/color][color=#007700]([/color][color=#DD0000]"%c"[/color][color=#007700],[/color][color=#0000BB]MOTsEcret[/color][color=#007700][[/color][color=#0000BB]i[/color][color=#007700]]);
}[/color][/color][/font]

 

euh ?

---------------------------------------------------------------------------------------------------------------

voila le code En Mini

#include 
#include 
char getlettre()
{

   char caractere = 0;
   caractere = getchar();
   caractere = toupper(caractere);
   while (getchar() != '\n') ;
   return caractere;

}
void afficherMotQ(int MotDonner[],char MOTsEcret[])
{ int i=0;
  for (i=0;i{
if(MotDonner[i])
        {
          printf("*");

         }
   else

      {
        printf("%c",MOTsEcret[i]);
      }

}
}
int main()
{
   char motseCret[]="MARRON";
   int motdoNner[6]={0};
   char lettre=0;
   int i=0;
   lettre=getlettre();
   afficherMotQ(motdoNner,motseCret);
}

 

Modifié par namster
Lien vers le commentaire
Partager sur d’autres sites

Rejoindre la conversation

Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.

Invité
Répondre à ce sujet…

×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

  Seulement 75 émoticônes maximum sont autorisées.

×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

×   Votre contenu précédent a été rétabli.   Vider l’éditeur

×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

  • Messages

    • 2021 Associated Press Novice of the Year and Samuelsson Go To Nigerian Dining Establishment In NYCNew York Liberty ahead Michaela Onyenwere, 2021 Associated Press Newbie of the Year, goes to a Nigerian dining establishment in Brooklyn with prize-winning cook, business owner, writer and food activist Marcus Samuelsson on the most recent episode of Home Plate, the brand-new original shows series on the YES App, the YES Network's main this installment of Home base, Onyenwere, whose parents hail from Nigeria, and Samuelsson see Buka restaurant in Brooklyn, which concentrates on Nigerian cuisine. While there, she talks about with Samuelsson and Buka owner/chef Lookman Afolayan her hoping for home-cooked Nigerian meals and her interest for Nigerian society. Onyenwere also chats regarding fashion and her own line of by Samuelsson, Home base includes his coordinating with players from the New Yankees, Brooklyn Nets, New York Liberty and New York City FC, along with with celebs. Together, they check out New York City dining establishments focusing on food from the visitors' corresponding societies and family members heritages Esmery Martinez Jersey. The collection highlights the diverse societies and various foods represented in New York City restaurants, with Samuelsson and his guests discussing the vital duty that food has actually played in their is a brief clip from the YES App's Home Plate series is available to confirmed YES subscribers. The application can be downloaded and install below.
    • Looking for fun companions for night adventures? Authentic Ladies Premier Сasual Dating
    • Find a partner for a good time Actual Girls Superlative Сasual Dating
    • Performance speedtest en mars 2024 sur toutes les wilayas c'est nouveau ca y a même les communes 😁 https://www.speedtest.net/performance/algeria/algiers?fbclid=IwZXh0bgNhZW0CMTAAAR2EZ-br3gKlcAzx0oXT8UenXWtbjTkj2QOdqLLfd8yRosY_u6D3Q27_3ug_aem_AfH7waTumC2Pz7en4W640IUHAyksA4X4Y8nSL4ssJNIQNHEgNeqqnlcMWGkGeTzGHKhwthYFUiGePCB1KHW4DMP-
    • @XXX Proposer la carte chiffa sur un site internet...n'a rien d'une innovation. C'est juste un fichier jpeg...en ce qui me concerne! Si la cnad veut faire quelque-chose d'utile qu'ils élimine le papier pour les remboursements !!!!!!!!!!
×
×
  • Créer...