⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 z4.cpp

📁 this is the microcontroller code for blinking of leds
💻 CPP
字号:
#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
 int i,j,r,c,k;
 cout<<"\nEnter the no. of row";
cin>>r;
 cout<<"\nEnter the no. of columns";
cin>>c;
int g[11][11],cr,k1=1,k2=0;
int lam[4],lg[15][15][15],lg4[15][15][15];
for(i=0;i<4;i++)
 lam[i]=i;

for(i=0;i<r;i++)
{
   cout<<"\nEnter the row no:"<<i+1<<"\n";
  for(j=0;j<c;j++)
  {
    cin>>g[i][j];
    for(k=0;k<4;k++)
      lg[i][k][j]=lam[k]*g[i][j];
  }
}


for(i=0;i<r;i++)
{
  for(k=0;k<4;k++)
  {
    for(j=0;j<c;j++)
      cout<<lg[i][k][j];
   cout<<"  ";
  }
  cout<<"\n";
}

cr=pow(4,k1)*pow(2,k2);
cout<<"\ncr:"<<cr<<"\n";

int count=0,cn;
cn=pow(4,r);
int cod[512][15];

for(i=0;i<cn;i++)
  for(j=0;j<c;j++)
     cod[i][j]=0;


for(j=0;j<cn;j++)
{
  for(i=0;i<r;i++)
  {
   for(k=0;k<c;k++)
   {
     int mz=count/(pow(4,(r-i-1)));
     mz=mz%4;
     cod[j][k]=cod[j][k]+lg[i][mz][k];
     if(i==(r-1))
      {
	cod[j][k]=cod[j][k]%4;
	cout<<cod[j][k];
      }
    }
    cout<<"\t";
   }
  count++;
}


/*for(j=0;j<cn;j++)
{
  for(k=0;k<c;k++)
      cout<<cod[j][k];
   cout<<"\t";
}


for(i=0;i<r;i++)
{
  for(j=0;j<4;j++)
  {
   for(k=0;k<c;k++)
    {
     lg4[i][j][k]=lg[i][j][k]%4;
     cout<<lg4[i][j][k];
     }
    cout<<"  ";
   }
  cout<<"\n";
}

//lg[i],t*/

getch();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -