求帮:这段c++代码得不到想要结果


#include<iostream>
using namespace std;
int main()
{
    
     cout<<"*";
    cout<<"***";
   cout<<"*****";
}

我想实现
img
却不知道为什么只输出了一行(我是小白,刚学)


 
#include<iostream>
using namespace std;
int main()
{
     cout<<"  *"<<endl;
     cout<<" ***"<<endl;
     cout<<"*****"<<endl;//endl是换行,不能靠代码的换行来实现程序的换行//空格也是要加到输出里的诶
}

在cout中使用endl表示一行结束
要换行得这么写:


#include <iostream>
using namespace std;
int main()
{
    cout << "*" << endl;
    cout << "***" << endl;
    cout << "*****" << endl;
}