رنگبندی هر ماتریس در c++

smnzzkhn

New Member
سلام٬ من برنامه زیر رو دارم
کار برنامه به صورتی هستش که هر کارکتر بزرگ انگلیسی که از ورودی بگیره رو به صورت ماتریس ۸×۸ چاپ میکنه و در خروجی تحویل میده
حالا من میخوام هر کارکتر مثلا حرف B با رنگ آبی نمایش داده بشه و A مثلا همیشه به رنگ زرد باشه٬ کسی میتونه کمکی بکنه؟

کد:
#include <iostream>

using namespace std;

int character_B[]={
1,1,1,1,1,1,0,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,1,0,
1,1,1,1,1,1,0,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,1,0,
1,1,1,1,1,1,0,0};




int character_A[] ={
0,0,0,1,1,0,0,0,
0,0,1,0,0,1,0,0,
0,1,0,0,0,0,1,0,
1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1
};



int character_C[] ={
0,0,1,1,1,1,1,0,
0,1,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
0,1,0,0,0,0,0,0,
0,0,1,1,1,1,1,0
};



int character_D[] ={
1,1,1,1,1,1,0,0,
1,0,0,0,0,0,1,0,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,1,0,
1,1,1,1,1,1,0,0
};



int character_E[] ={
1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1
};

int character_F[] ={
1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,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1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0
};

int character_U[] ={
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
0,1,1,1,1,1,1,0
};

int character_V[] ={
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,0,0,1,0,0,
0,0,0,1,1,0,0,0
};

int character_W[] ={
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,1,1,0,0,1,
1,0,1,0,0,1,0,1,
1,1,0,0,0,0,1,1,
1,0,0,0,0,0,0,1
};

int character_X[] ={
1,0,0,0,0,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,0,0,1,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,1,0,0,1,0,0,
0,1,0,0,0,0,1,0,
1,0,0,0,0,0,0,1
};

int character_Y[] ={
1,0,0,0,0,0,0,1,
0,1,0,0,0,0,1,0,
0,0,1,0,0,1,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0
};

int character_Z[] ={
1,1,1,1,1,1,1,1,
0,0,0,0,0,0,1,0,
0,0,0,0,0,1,0,0,
0,0,0,0,1,0,0,0,
0,0,0,1,0,0,0,0,
0,0,1,0,0,0,0,0,
0,1,0,0,0,0,0,0,
1,1,1,1,1,1,1,1
};

void PrintChar_A(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_B(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_C(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_D(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_E(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_F(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_G(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_H(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_I(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_J(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_K(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_L(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_M(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_N(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_O(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_P(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_Q(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_R(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_S(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_T(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_U(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_V(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_W(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_X(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_Y(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

void PrintChar_Z(int *ch)
{
for( int j=0; j<8; j++){
cout<<"\n";
for( int i=0; i<8; i++)
if( ch[j*8+i] )
cout<<"*";
else
cout<<" ";
}
}

int main()
{
char charactere;
cout<<"plz enter character :"<<endl;
cin>>charactere;
while(charactere !=0)
{
switch (charactere)
{
case 'A':
PrintChar_A(character_A);
break;
case 'B':
PrintChar_B(character_B);
break;
case 'C':
PrintChar_C(character_C);
break;
case 'D':
PrintChar_D(character_D);
break;
case 'E':
PrintChar_E(character_E);
break;
case 'F':
PrintChar_F(character_F);
break;
case 'G':
PrintChar_G(character_G);
break;
case 'H':
PrintChar_H(character_H);
break;
case 'I':
PrintChar_I(character_I);
break;
case 'J':
PrintChar_J(character_J);
break;
case 'K':
PrintChar_K(character_K);
break;
case 'L':
PrintChar_L(character_L);
break;
case 'M':
PrintChar_M(character_M);
break;
case 'N':
PrintChar_N(character_N);
break;
case 'O':
PrintChar_O(character_O);
break;
case 'P':
PrintChar_P(character_P);
break;
case 'Q':
PrintChar_Q(character_Q);
break;
case 'R':
PrintChar_R(character_R);
break;
case 'S':
PrintChar_S(character_S);
break;
case 'T':
PrintChar_T(character_T);
break;
case 'U':
PrintChar_U(character_U);
break;
case 'V':
PrintChar_V(character_V);
break;
case 'W':
PrintChar_W(character_W);
break;
case 'X':
PrintChar_X(character_X);
break;
case 'Y':
PrintChar_Y(character_Y);
break;
case 'Z':
PrintChar_Z(character_Z);
break;
default :
cout<<"SORRY YOUR NAME NOT SUPORTED !!!"<<endl;
break;
}
cout<<endl;
cin>>charactere;
}

return 0;
}
 
آخرین ویرایش:

جدیدترین ارسال ها

بالا