我都用上最笨的办法了,这个哪里有问题吗求助大佬
#include <iostream>
#include <cstring>
using namespace std;
int length(string x);
int main()
{
string a,b,c;
cin>>a>>b>>c;
length(a);
length(b);
length(c);
return 0;
}
int length(string x)
{
int length=x.size();
if(length==1)
{
cout<<" "<<x<<" ";
}
if(length==2)
{
cout<<" "<<x<<" ";
}
if(length==3)
{
cout<<" "<<x<<" ";
}
if(length==4)
{
cout<<" "<<x<<" ";
}
if(length==5)
{
cout<<" "<<x<<" ";
}
if(length==6)
{
cout<<" "<<x<<" ";
}
if(length==7)
{
cout<<" "<<x<<" ";
}
if(length==8)
{
cout<<x<<" ";
}
if(length==9)
{
cout<<x<<" ";
}
return 0;
}