0
Hi! I'm newbie here. Would you teach me how to make this with c++ program. thank you!
* ** *** **** ***** ****** *** ***
3 Answers
0
Ther are many solutions, especially in C++.
The easiest way to do this template, just add to your code a cout Syntax:
#include <iostream>
int main() {
std::cout<<" *\n";
std::cout<<" **\n";
//Follow this shape ;)
return 0;
}
But if you want to make it "automatically", you could also make some Arrays, Loops ... ( and so also arise algorithms ).
An easy for-loop example:
#include <iostream>
using namespace std;
int main()
{
int SetAmount, Space, SomeSymbol;
//Loop SetAmount 10 times = 10 rows
for(SetAmount = 0; SetAmount <= 10; SetAmount++){
for(Space = 0; Space <= SetAmount; Space++)
cout << " ";
for(SomeSymbol = 10; SomeSymbol > SetAmount; SomeSymbol--)
cout << "*" << endl;
} return 0;
}
That example above is one of many variations. :)
+ 1
@valenzelektron thank you very much ^^