#41645: c++解法+注意事項 記得加單引號,而不是雙引號呀~~


yp11351280@yphs.tp.edu.tw (810-43韓睿哲)


由於是字元,所以加上去的是單引號,而不是雙引號。

只需用一個for迴圈就能解決的方法:

include<bits/stdc++.h>
using namespace std;
int main()
{
     int a;
     cin>>a;
     for(int b=1;b<a+1;b++)
     {
         cout<<string(a-b,'_');
        cout<<string(b,'*')<<endl;
     }
return 0;
}