- 1
how to generate different asterisk(*) pattern in c++???
different star patterns ascending, descending ,daimond shape, star shape etc
2 Answers
+ 2
check among the CPP codes in sololearn by possibly typing in keywords like "star patterns", "CPP patterns", etc...
- 1
use cout with manipulators in loop, like width()
use this stylish N play with it to explore more
#include <iostream>
using namespace std;
int main()
{
char c='*';
for(int i=0,j=10;i<10,j>0;i++,j--)
{
cout.width(i+1);
cout<<c;
cout.width(i-1);
cout<<c;
cout.width(j-1);
cout<<c<<endl;
}
return 0;
}