Thread: Lettre k

  1. #1
    Registered User
    Join Date
    Apr 2015
    Posts
    1

    Red face Lettre k

    Hello world im french i must write code to find letter k with 10 drops + or -
    Code:
    #include <iostream> 
    #include <stdlib.h> 
     
    using namespace std; 
     
    int main() 
     
    { 
        char caractere='k'; 
        int essai=0; 
        
        do 
     
        {   
            cout << " Tapez une lettre au clavier"<< endl; 
            cout << " Vous avez 10 essais pour trouver la lettre mystere."<< endl; 
            cin >> caractere ; 
            
            essai=essai+1; // incrementation du nombre d'essai 
        } 
    
    
     
           if (caractere=='k') // test de condition 
        { 
         
        cout << " bravo vous avez trouvez la bonne lettre " << endl ; 
        cout << " Vous avez eu besoin de " << essai << " essai pour trouver la lettre mystere " << endl ; 
         
        }  
         if(caractere !='k') 
       
        {   
         cout  << "Plus !" << endl; 
     } 
       
         else 
        { 
       
         cout << " Moins !" << endl; 
        } 
      
     while (caractere=='k'); // boucle tant que le joueur ne trouve pas la lettre mystere 
      
         
        return 0; 
     
        system ("PAUSE" ); 
        
     
        
    }

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Help on this has been provided elsewhere.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed