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

Probléme Declaration Vriable


namster

Messages recommandés

Salut,

Voila je viens de terminer mon Prog "Jeux Debile:eek:"Mais bon il resemble au JUSTE PRIX pour ceux qui connaisse bon en voulant le compiler j'ai u un petit problème voila Le prog

#include 
#include 
#include 

using namespace std;

int main()
long choix=0;

{
do
{

   const long MAX = 100, MIN = 1;
   long nombredonner;
   long nombreMystere;
   long coups=0;
       srand(time(NULL));
nombreMystere = (rand() % (MAX - MIN + 1)) + MIN;

  //on demande le nombre
   printf("Le Juste Prix\n");
   printf("Vous Devez Me Donne Un Prix Entre 1 100 euro \n et je vous dirait cet plus ou cet moins \n");
   do
       {
                coups++;
                    scanf("%i",&nombredonner);
   // on compare le nombre donner
   if (nombreMystere     printf("Cet -\n");

    else if (nombreMystere>nombredonner)

         printf("Cet+\n");

else
printf("Bravo Tu as trouve le Juste Prix\n en ,%i coups\n",coups);
   }
   while (nombredonner != nombreMystere);
   printf("Si Tu Veut rejouer Tape 1 Si Non tape 2");
   scanf("%i",&choix);

}
while (choix==2);
system("PAUSE");
   return 0;
}


et voila l'erreur

\vincent la gaf\main.cpp|44|error: 'choix' was not declared in this scope|

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

déclare "choix" en dehors de la structure do {}

 

En la déclarant à l'intérieur de cette boucle, elle ne sera pas accessible depuis l'extérieur !

 

Oui Cet Bon Sa Marche,Maintenant Il Faut A jouter La Difficulté facile ....ect,Mais j'ai Un Problème De Envoyer Ne PAS envoyer

Lien vers le commentaire
Partager sur d’autres sites

Salut,

Voila je viens de terminer mon Prog "Jeux Debile:eek:"Mais bon il resemble au JUSTE PRIX pour ceux qui connaisse bon en voulant le compiler j'ai u un petit problème voila Le prog

#include 
#include 
#include 

using namespace std;

int main()


[color="red"]long choix=0;[/color]

{
[color="lime"]long choix=0[/color];

do
{

   const long MAX = 100, MIN = 1;
   long nombredonner;
   long nombreMystere;
   long coups=0;
       srand(time(NULL));
nombreMystere = (rand() % (MAX - MIN + 1)) + MIN;

  //on demande le nombre
   printf("Le Juste Prix\n");
   printf("Vous Devez Me Donne Un Prix Entre 1 100 euro \n et je vous dirait cet plus ou cet moins \n");
   do
       {
                coups++;
                    scanf("%i",&nombredonner);
   // on compare le nombre donner
   if (nombreMystere     printf("Cet -\n");

    else if (nombreMystere>nombredonner)

         printf("Cet+\n");

else
printf("Bravo Tu as trouve le Juste Prix\n en ,%i coups\n",coups);
   }
   while (nombredonner != nombreMystere);
   printf("Si Tu Veut rejouer Tape 1 Si Non tape 2");
   scanf("%i",&choix);

}
while (choix==2);
system("PAUSE");
   return 0;
}


et voila l'erreur

\vincent la gaf\main.cpp|44|error: 'choix' was not declared in this scope|

 

le problème est dans la ligne en rouge , choix doit être déclarer dans "main" non dehors.

après que j'ai déclarer choix dans main le programme a compilé et exécuté bien.

ps: le programme est en C++ je croit non ?

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

le problème est dans la ligne en rouge , choix doit être déclarer dans "main" non dehors.

après que j'ai déclarer choix dans main le programme a compilé et exécuté bien.

ps: le programme est en C++ je croit non ?

 

Euh Non Le Programme Est EN c Mais Bon Le Voila Sans BUG

#include 
#include 
#include 
#include 


int main()


{ long choix=1;
   do
{
   long MAX=0;
   long MIN=1;
   long nombredonner;
   long nombreMystere;
   long coups=0;
   long difficulter=1;


   printf("Choisi La Difficulte\n");
   printf("Facile 'entre 1 et 100' Tapez 1\n");
   printf("Moyenne'entre 1 et 1000' Tapez 2\n");
   printf("Difficile'entre 1 et 10000' Tapez 3\n");
   scanf("%i",&difficulter);
   if (difficulter==1)
    {MAX=100;
    }
    else if (difficulter==2)
    {MAX=1000;
    }
    else if (difficulter==3)
   {MAX=10000;
   }



srand(time(NULL));
nombreMystere = (rand() % (MAX - MIN + 1)) + MIN;
printf("------------------------------------Le Juste Prix------------------------------------\n");
   printf("Vous Devez Me Donne Un Prix Entre %i et %i euro \n et je vous dirait cet plus ou cet moins \n",MIN,MAX);

   do
       {

                coups++;
                    scanf("%I",&nombredonner);
   // on compare le nombre donner
   if (nombreMystere     printf("Cet -\n");

    else if (nombreMystere>nombredonner)

         printf("Cet+\n");

else
printf("Bravo Tu as trouve le Juste Prix\n en ,%i coups\n",coups);
   }
   while (nombredonner != nombreMystere);
   printf("Si Tu Veut rejouer Tape 1 Si Non tape 0\n");
   scanf("%i",&choix);

}
while (choix==1);
system("PAUSE");
   return 0;
}




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

    • @Lyès alors probablement c'est que la carte marche mais DJEZZY et la CNAS sont les services mis en avant.... entre temps je te pose une question puisque tu es la..........pourquoi l'algerie n'a jamais accepté VISA et MASTERCARD ? pourquoi il aura fallut attendre 2025 alors que tous les pays du monde les utilisent depuis plus de 40 ans ????
    • jai vu la semaine passee des gens obtenir ces 90 euros a la banques....apres 2h d'attente...donc oui ca existe encore
    • The packaging industry has witnessed significant advancements with the rise of automation, and  Capping Machine Manufacturers are at the forefront of these innovations. Among them, Taizhou Chuangzhen Machinery Manufacturing has been a key player, providing automatic capping machines that boost efficiency and precision in production lines. These automated systems are designed to meet the growing demand for faster packaging speeds and consistent product quality across industries such as pharmaceuticals, cosmetics, food, and chemicals. Automation in capping processes reduces human error and enhances production consistency. Modern automatic capping equipment by leading suppliers offers programmable torque settings and adaptable mechanisms that can handle a range of container shapes and cap types. Taizhou Chuangzhen utilizes advanced servo motors and PLC control systems to deliver machines that can switch between different packaging lines quickly, minimizing downtime and maximizing output. Another critical focus for capping equipment producers is the integration of smart diagnostics and remote monitoring capabilities. These features allow operators to track performance data, detect potential faults early, and perform adjustments without halting the production line. Taizhou Chuangzhen has incorporated these technologies into their automatic capping machines, enhancing reliability and user convenience. Energy efficiency is also a priority in the design of modern capping machines. Manufacturers aim to reduce power consumption by using efficient motors and optimizing mechanical components. This not only lowers operating costs but also supports environmental sustainability efforts—a value increasingly recognized by end users. Taizhou Chuangzhen adopts such eco-conscious design principles, aligning its product offerings with global green manufacturing trends. Maintenance friendliness is crucial to reducing machine downtime. By designing easy-to-access components and incorporating intuitive control panels, manufacturers make it simpler for operators to conduct routine inspections and repairs. Taizhou Chuangzhen’s machines feature user-friendly interfaces and remote troubleshooting options, providing customers with dependable support worldwide.For detailed information on the range of automatic capping machines available from Taizhou Chuangzhen Machinery Manufacturing, please visit: https://www.capping-machine.net/product/ .
    • Pareil avec mon VSOL,ont-ils augmenté les vitesses de l’offre ?  
    • Ne fait surtout pas le reset. Moi je l’es fait est j’ai perdue totalement l’accès aux régalage avancées. Je regrette!
×
×
  • Créer...