- 1

how to generate different asterisk(*) pattern in c++???

different star patterns ascending, descending ,daimond shape, star shape etc

11th Sep 2017, 12:05 PM
demented_soul
demented_soul - avatar
2 Answers
+ 2
check among the CPP codes in sololearn by possibly typing in keywords like "star patterns", "CPP patterns", etc...
11th Sep 2017, 12:08 PM
Rahul George
Rahul George - avatar
- 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; }
11th Sep 2017, 12:12 PM
Morpheus
Morpheus - avatar