feng_nuoyiman @ 2022-05-03 22:41:33
疑似早期计算机显示屏
#include<iostream>
#include<cstring>
using namespace std;
long long n;
string ans[100000][5]={};
char a[100000];
int main()
{
cout<<"输入字符总数:"<<endl;
cin>>n;
cout<<"输入字符:"<<endl;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]=='0'){
ans[i][1]="XXX";
ans[i][2]="X.X";
ans[i][3]="X.X";
ans[i][4]="X.X";
ans[i][5]="XXX";
}
if(a[i]=='1'){
ans[i][1]="..X";
ans[i][2]="..X";
ans[i][3]="..X";
ans[i][4]="..X";
ans[i][5]="..X";
}
if(a[i]=='2'){
ans[i][1]="XXX";
ans[i][2]="..X";
ans[i][3]="XXX";
ans[i][4]="X..";
ans[i][5]="XXX";
}
if(a[i]=='3'){
ans[i][1]="XXX";
ans[i][2]="..X";
ans[i][3]="XXX";
ans[i][4]="..X";
ans[i][5]="XXX";
}
if(a[i]=='4'){
ans[i][1]="X.X";
ans[i][2]="X.X";
ans[i][3]="XXX";
ans[i][4]="..X";
ans[i][5]="..X";
}
if(a[i]=='5'){
ans[i][1]="XXX";
ans[i][2]="X..";
ans[i][3]="XXX";
ans[i][4]="..X";
ans[i][5]="XXX";
}
if(a[i]=='6'){
ans[i][1]="XXX";
ans[i][2]="X..";
ans[i][3]="XXX";
ans[i][4]="X.X";
ans[i][5]="XXX";
}
if(a[i]=='7'){
ans[i][1]="XXX";
ans[i][2]="..X";
ans[i][3]="..X";
ans[i][4]="..X";
ans[i][5]="..X";
}
if(a[i]=='8'){
ans[i][1]="XXX";
ans[i][2]="X.X";
ans[i][3]="XXX";
ans[i][4]="X.X";
ans[i][5]="XXX";
}
if(a[i]=='9'){
ans[i][1]="XXX";
ans[i][2]="X.X";
ans[i][3]="XXX";
ans[i][4]="..X";
ans[i][5]="XXX";
}
if(a[i]=='A'){
ans[i][1]="..X..";
ans[i][2]=".X.X.";
ans[i][3]=".XXX.";
ans[i][4]="X...X";
ans[i][5]="X...X";
}
if(a[i]=='B'){
ans[i][1]="XXX..";
ans[i][2]="X..X.";
ans[i][3]="XXX..";
ans[i][4]="X..X.";
ans[i][5]="XXX..";
}
if(a[i]=='C'){
ans[i][1]="..XXX";
ans[i][2]=".X...";
ans[i][3]="X....";
ans[i][4]=".X...";
ans[i][5]="..XXX";
}
if(a[i]=='D'){
ans[i][1]="XXX..";
ans[i][2]="X..X.";
ans[i][3]="X...X";
ans[i][4]="X..X.";
ans[i][5]="XXX..";
}
if(a[i]=='E'){
ans[i][1]="XXXXX";
ans[i][2]="X....";
ans[i][3]="XXXXX";
ans[i][4]="X....";
ans[i][5]="XXXXX";
}
if(a[i]=='F'){
ans[i][1]="XXXXX";
ans[i][2]="X....";
ans[i][3]="XXXX.";
ans[i][4]="X....";
ans[i][5]="X....";
}
if(a[i]=='G'){
ans[i][1]="..XXX";
ans[i][2]=".X...";
ans[i][3]="X...X";
ans[i][4]=".X..X";
ans[i][5]="..XXX";
}
if(a[i]=='H'){
ans[i][1]="X...X";
ans[i][2]="X...X";
ans[i][3]="XXXXX";
ans[i][4]="X...X";
ans[i][5]="X...X";
}
if(a[i]=='I'){
ans[i][1]=".XXX.";
ans[i][2]="..X..";
ans[i][3]="..X..";
ans[i][4]="..X..";
ans[i][5]=".XXX.";
}
if(a[i]=='J'){
ans[i][1]=".XXX.";
ans[i][2]="..X..";
ans[i][3]="..X..";
ans[i][4]="X.X..";
ans[i][5]=".XX..";
}
if(a[i]=='K'){
ans[i][1]="X...X";
ans[i][2]="X..X.";
ans[i][3]="XXX..";
ans[i][4]="X.X..";
ans[i][5]="X...X";
}
if(a[i]=='L'){
ans[i][1]="X....";
ans[i][2]="X....";
ans[i][3]="X....";
ans[i][4]="X....";
ans[i][5]="XXXXX";
}
if(a[i]=='M'){
ans[i][1]=".X.X.";
ans[i][2]=".X.X.";
ans[i][3]="X.X.X";
ans[i][4]="X.X.X";
ans[i][5]="X.X.X";
}
if(a[i]=='N'){
ans[i][1]="XXX.X";
ans[i][2]="X.X.X";
ans[i][3]="X.X.X";
ans[i][4]="X.X.X";
ans[i][5]="X.XXX";
}
if(a[i]=='O'){
ans[i][1]=".XXX.";
ans[i][2]="XX.XX";
ans[i][3]="X...X";
ans[i][4]="XX.XX";
ans[i][5]=".XXX.";
}
if(a[i]=='P'){
ans[i][1]="XXXX.";
ans[i][2]="X...X";
ans[i][3]="XXXX.";
ans[i][4]="X....";
ans[i][5]="X....";
}
if(a[i]=='Q'){
ans[i][1]=".XXX.";
ans[i][2]="X...X";
ans[i][3]="X...X";
ans[i][4]="X.X.X";
ans[i][5]=".XXXX";
}
if(a[i]=='R'){
ans[i][1]="XXXX.";
ans[i][2]="X...X";
ans[i][3]="XXXX.";
ans[i][4]="X.X..";
ans[i][5]="X..XX";
}
if(a[i]=='S'){
ans[i][1]=".XXXX";
ans[i][2]="X....";
ans[i][3]=".XXX.";
ans[i][4]="....X";
ans[i][5]="XXXX.";
}
if(a[i]=='T'){
ans[i][1]="XXXXX";
ans[i][2]="..X..";
ans[i][3]="..X..";
ans[i][4]="..X..";
ans[i][5]="..X..";
}
if(a[i]=='U'){
ans[i][1]="X...X";
ans[i][2]="X...X";
ans[i][3]="X...X";
ans[i][4]="X...X";
ans[i][5]=".XXX.";
}
if(a[i]=='V'){
ans[i][1]="X...X";
ans[i][2]="X...X";
ans[i][3]="X...X";
ans[i][4]=".X.X.";
ans[i][5]="..X..";
}
if(a[i]=='W'){
ans[i][1]="X.X.X";
ans[i][2]="X.X.X";
ans[i][3]="X.X.X";
ans[i][4]="XXXXX";
ans[i][5]=".X.X.";
}
if(a[i]=='X'){
ans[i][1]="X...X";
ans[i][2]=".X.X.";
ans[i][3]="..X..";
ans[i][4]=".X.X.";
ans[i][5]="X...X";
}
if(a[i]=='Y'){
ans[i][1]="X...X";
ans[i][2]="X...X";
ans[i][3]=".X.X.";
ans[i][4]="..X..";
ans[i][5]="..X..";
}
if(a[i]=='Z'){
ans[i][1]="XXXXX";
ans[i][2]="...X.";
ans[i][3]="..X..";
ans[i][4]=".X...";
ans[i][5]="XXXXX";
}
if(a[i]=='_'){
ans[i][1]=".....";
ans[i][2]=".....";
ans[i][3]=".....";
ans[i][4]=".....";
ans[i][5]="XXXXX";
}
}
for(int i=1;i<=5;i++){
for(int j=1;j<=n;j++){
cout<<ans[j][i];
if(j!=n) cout<<".";
}
cout<<endl;
}
return 0;
}
效果:
输入字符总数:
13
输入字符:
FENG_NUOYIMAN
XXXXX.XXXXX.XXX.X...XXX.......XXX.X.X...X..XXX..X...X..XXX...X.X....X...XXX.X
X.....X.....X.X.X..X..........X.X.X.X...X.XX.XX.X...X...X....X.X...X.X..X.X.X
XXXX..XXXXX.X.X.X.X...X.......X.X.X.X...X.X...X..X.X....X...X.X.X..XXX..X.X.X
X.....X.....X.X.X..X..X.......X.X.X.X...X.XX.XX...X.....X...X.X.X.X...X.X.X.X
X.....XXXXX.X.XXX...XXX.XXXXX.X.XXX..XXX...XXX....X....XXX..X.X.X.X...X.X.XXX
--------------------------------
Process exited after 38.59 seconds with return value 0
请按任意键继续. . .
代码略长,勿喷 另:求字母小写像素化
by ppip @ 2022-05-03 23:32:22
建议了解一下生(raw)字符串