C++:用*输出字母K

来源:百度知道 编辑:UC知道 时间:2024/05/27 08:11:45
急着用,谢谢!!
用C++编程:编出字母“K” 用算法吧。,最好别用数组,跟直接写没两样,谢谢

cout<<"* *\n";
cout<<"\n";
cout<<"\n";
cout<<"\n";
cout<<"*";
最笨的..
用算法的要看你想输出多大的了!

刚写的,感觉很衰.可以动态的设定K的大小.

cout<<"This will be the first Come";
int i,j;
cout<<"Pls enter two number to tell me the size of the K\n";
cin>>i;
cin>>j;
int a=1;
for(;a<=i/2;a++)
{
j--;
cout<<"*";
for(int b=j;b>=0;b--)
{
cout<<" ";
}
cout<<"*\n";
}
for(a=i/2;a<=i;a++)
{
j++;
cout<<"*";
for(int b=0;b<=j;b++)
{
cout<<" ";
}
cout<<"*\n";
}
getchar();
getchar();
return 0;

#include <iostream>
#include &l