|
![](https://att.itzmx.com/static/image/common/ico_lz.png)
楼主 |
发表于 2023/3/12 13:26
|
显示全部楼层
|![](https://att.itzmx.com/source/plugin/chxs_icons/images/net/firefox.png) Firefox 107.0 |![](https://att.itzmx.com/source/plugin/chxs_icons/images/os/win-5.png) Windows 10
//C++代码(生成ascii艺术)
#include<iostream>
#include<cstring>
using namespace std;
const int w=100,h=188;
string u(string a)//临时自制函数,没卵用
{
int siz=a.size();
for(int i=0;i<siz;i++)
{
if(a==' '){a.erase(a.begin()+i); siz=a.size(); i-=1; continue;}//清空格
else if(a=='q'||a=='Q'){a='C';}
else if(a=='i'||a=='I'){a='Y';}
else if(a>='a'&&a<='z'){a=a-'a'+'A';}//toUpper()
}
return a;
}
int main()
{
static char chr[h+7][w+7];
int len=w,hh=0,size;
string a,s,d,f;
a="QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ";
cin>>s>>d>>f;
//a
{
int i=-1,siz=a.size();//for(int count=0,i=-1,siz=a.size();count<1;count++,i=-1,siz=a.size())
while(siz>len)
{
siz-=len;
for(len;len>0;len-=1)
{
chr[hh][w-len]=a[++i];
}
hh+=1;len=w;
}
{
for(len;siz>0;len-=1,siz-=1)
{
chr[hh][w-len]=a[++i];
}
}
}
//s
for(int count=0,i=-1,siz=s.size();count<25;count++,i=-1,siz=s.size())
{
while(siz>len)
{
siz-=len;
for(len;len>0;len-=1)
{
chr[hh][w-len]=s[++i];
}
hh+=1;len=w;
}
{
for(len;siz>0;len-=1,siz-=1)
{
chr[hh][w-len]=s[++i];
}
}
}
//d
for(int count=0,i=-1,siz=d.size();count<2;count++,i=-1,siz=d.size())
{
while(siz>len)
{
siz-=len;
for(len;len>0;len-=1)
{
chr[hh][w-len]=d[++i];
}
hh+=1;len=w;
}
{
for(len;siz>0;len-=1,siz-=1)
{
chr[hh][w-len]=d[++i];
}
}
}
//f
for(int count=0,i=-1,siz=f.size();count<1;count++,i=-1,siz=f.size())
{
while(siz>len)
{
siz-=len;
for(len;len>0;len-=1)
{
chr[hh][w-len]=f[++i];
}
hh+=1;len=w;
}
{
for(len;siz>0;len-=1,siz-=1)
{
chr[hh][w-len]=f[++i];
}
}
}
// for(int i=0;i<h;i++){
// for(int j=0;j<w;j++){
// cout<<chr[j];}cout<<endl;}
len=w;hh=0;
int number; string color;
do{
cin>>number>>color;
cout<<"[color=#"<<color<<"]";for(int i=0;i<number;i+=1,len-=1){cout<<chr[hh][w-len];}cout<<"";
if(len<=0){len=w;hh+=1;cout<<endl;}//换行
}while(number);
}
/*字符处理草稿,bc段为a段部分,若a段长度不够就接nb+c/bbbbbbbc,余下部分开头接A
100*188=18800 18798+QQ
18792/730=25 548/730
548/163=2+1(178) 44/179
QQNAYTNAYPYYEHZQAYXGNAUHCQQYAZGNAYLEDGNOGGNAYNUHCQQNAYXGNYJGNEFEDGNAYCYUZOAYBYDEHZYEWGNEHCOAYGNYDQQNAYBNYJGNAYXYZADGNOGNEFGNAYNUHCYAPOAHZGNOTGNEHZQQNAYTNUYURGNEHOAHUOLOAGOUZYYNAZQQNAYBUBGNOYGNYDNAYJQQNAYNNYXEDEYYHSOAGQQNALOBUOYEKNAKUOYQQEUYYUSEDOBOAYPNAGNAHCQQEYDQREVENQSMAERDQQUOYYZEDGNYBAUHZUOHSOUGOUHQQNAUHUHYAZGNEFNAYDGNEHSOADEDGNAYXGNEMQQGNOOOOOOHCQQAYXOAHZGNYYYLNAWGNEHCNAYCNAKQQAUHYHZGNAYNUHCQQAPYAZYEMYZYDNEMNAUGQQNAYEHAYHCNAYPYAQQANGNAHSYEBUTADOALQQGNALUBNAYNOAHSYHSOADUOYQQEYLAHCOAHZYLYHSEUOYYAHQQAUHNYHULGNOHZGNEHCOUHSGNYTQQOAYGNOREDGNAHZOADUYLGNAHSQQUOYYUHYACQNAGYLUNQQ9AYJAHSEDYJ6UZGNOHCNAUSUYQQOAYDEGOAYQGNAHCYAPOAYQQOAGABOAYGNAWGNEHSEYGNAHQQOAHNAYJOAYGN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