Anti-armenia.ORG - Forumlar - LCD_Display [FIXED]



Istifadəçi
    2012-05-30 12:40 GMT                 

Mr.0c3aN



İstifadəçi
Mesaj Sayı : 144
Mövzu Sayı :
Rep Ver : 
Rep Sayı :   5  
Indi Saytda : Durum
Cinsiyyət : Oğlan
Şəhər : Putnam, Connecticut
Ölkə :
Məslək : System & Algorithmic Programmer, Security Professional
Yaş : 121
Mesaj :

Mövzunu Paylaş!


Bu mövzuda girilən ədədləri ve böyüklüyü analiz edərək CMD-dəki kimi rəqəminizi ekrana verən kodumu paylaşacağam. Lazım olar

Programlama Dili: C++
Compiler: gnuc++
Tövsiyyə olunan Editor: CodeBlocks vəya Dev-C++

Kod:
#include <iostream>
#include <math.h>
using namespace std;
const char DIGITS[10][5][3] =
{{{' ','-',' '},
   {'|',' ','|'},
   {' ',' ',' '},
   {'|',' ','|'},
   {' ','-',' '}}, //0
   {{' ',' ',' '},
   {' ',' ','|'},
   {' ',' ',' '},
   {' ',' ','|'},
   {' ',' ',' '}}, //1
   {{' ','-',' '},
   {' ',' ','|'},
   {' ','-',' '},
   {'|',' ',' '},
   {' ','-',' '}}, //2
   {{' ','-',' '},
   {' ',' ','|'},
   {' ','-',' '},
   {' ',' ','|'},
   {' ','-',' '}}, //3
   {{' ',' ',' '},
   {'|',' ','|'},
   {' ','-',' '},
   {' ',' ','|'},
   {' ',' ',' '}}, //4
   {{' ','-',' '},
   {'|',' ',' '},
   {' ','-',' '},
   {' ',' ','|'},
   {' ','-',' '}}, //5
   {{' ','-',' '},
   {'|',' ',' '},
   {' ','-',' '},
   {'|',' ','|'},
   {' ','-',' '}},//6
   {{' ','-',' '},
   {' ',' ','|'},
   {' ',' ',' '},
   {' ',' ','|'},
   {' ',' ',' '}},//7
   {{' ','-',' '},
   {'|',' ','|'},
   {' ','-',' '},
   {'|',' ','|'},
   {' ','-',' '}}, //8
   {{' ','-',' '},
   {'|',' ','|'},
   {' ','-',' '},
   {' ',' ','|'},
   {' ','-',' '}}};

int main()
{
   int s, n;
   int length;

   while (cin >> s >> n) {
       if (s == 0 && n == 0) {
           break;
       }
       if (s == 0) continue;
       if (n != 0)
           length=(int)log10((float)n)+1;
       else length=1;
       int feld[length];
       for (int i =length-1;i>=0;i--) {
           feld[i]=n%10;
           n/=10;
       }

       for (int i = 0;i<length;i++) {//first line
           cout<<" ";                           
           for (int z=0;z<s;z++)
               cout<<DIGITS[feld[i]][0][1];
           if (i!=length-1) cout<<"  ";
           else cout<<" ";
       }
       cout<<endl;
       for (int z =0;z<s;z++){    //second line
           for (int i = 0;i<length;i++) {       
               cout<<DIGITS[feld[i]][1][0];
               for (int b=0;b<s;b++)
                   cout<<" ";
               cout<<DIGITS[feld[i]][1][2];
               if (i!=length-1) cout<<" ";
           }
           cout<<endl;
       }
       for (int i = 0;i<length;i++) {//first line
           cout<<" ";                           
           for (int z=0;z<s;z++)
               cout<<DIGITS[feld[i]][2][1];
           if (i!=length-1) cout<<"  ";
           else cout<<" ";
       }
       cout<<endl;
       for (int z =0;z<s;z++){    //second line
           for (int i = 0;i<length;i++) {       
               cout<<DIGITS[feld[i]][3][0];
               for (int b=0;b<s;b++)
                   cout<<" ";
               cout<<DIGITS[feld[i]][3][2];
               if (i!=length-1) cout<<" ";
           }
           cout<<endl;
       }
       for (int i = 0;i<length;i++) {//first line
           cout<<" ";                           
           for (int z=0;z<s;z++)
               cout<<DIGITS[feld[i]][4][1];
           if (i!=length-1) cout<<"  ";
           else cout<<" ";
       }
       cout<<endl<<endl;
   }
}

Anti-armenia.ORG
    

Istifadəçi
    2012-05-31 10:26 GMT                 

Avatar Fearless



VIP
Mesaj Sayı : 1299
Mövzu Sayı :
Rep Ver : 
Rep Sayı :   23  
Indi Saytda : Durum
Cinsiyyət : Oğlan
Şəhər : Gävle
Ölkə :
Məslək : Hacker,Defacer,Programmer
Yaş : 26
Mesaj :

Mövzunu Paylaş!


Təşəkkürlər , Gözəl Paylaşım İşə Yaradı

http://s017.radikal.ru/i404/1202/c6/a2947080a3c4.png
Anti-armenia.ORG
    

Istifadəçi
    2012-05-31 10:27 GMT                 

Mr.0c3aN



İstifadəçi
Mesaj Sayı : 144
Mövzu Sayı :
Rep Ver : 
Rep Sayı :   5  
Indi Saytda : Durum
Cinsiyyət : Oğlan
Şəhər : Putnam, Connecticut
Ölkə :
Məslək : System & Algorithmic Programmer, Security Professional
Yaş : 121
Mesaj :

Mövzunu Paylaş!


Dəyməz

Anti-armenia.ORG