Results 1 to 4 of 4

Thread: ++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User tanago's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 322

    ++

    Code:
    #include<iostream.h>
    #include<fstream.h>
    int nmbs[10]={0,1,2,3,4,5,6,7,8,9};
    int array[8];
    int var;
    ofstream file ("passwords.txt");
    void Print(int l)
    {
         for(int i=0;i<l;i++)
          file<<array[i];
         file<<endl;
    }
    int allnine(int l)
    {
         int y=0;
         for(int i=0;i<l;i++)
         {
                 if(array[i]==9) y=1;
                 else return 0;
         }
         return y;
    }
    void check(int pos,int l)
    {
         if(array[pos-1]==9)check(pos-1,l);
         else 
         {
              array[pos-1]++;
              for(int i=pos;i<l;i++)
               array[i]=0;
         }
    }
    void change(int pos,int l)
    {
         for(int i=0;i<10;i++)
         {
                 array[pos]=nmbs[i];
                 Print(l);
         }
         if(allnine(l)==1) return;
         else
         {
             check(pos,l);
             change(pos,l);
         }
    }
    int main()
    {
        int l;
        cout<<"Kolko cifreno 4islo ti trqbva?"<<endl;
        cin>>l;
        int pos=(l-1);
        change(pos,l);
        system("pause");
        return 0;
    }
    - , 6,7,8...- 650819 . 5- . .

  2. #2
    Registered User 's Avatar
    Join Date: Feb:2006
    Location:
    Posts: 653

  3. #3
    Registered User tanago's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 322
    long? , long. "double array[10]" double, double, ? , . . ?

  4. #4
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |