-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstar.cpp
More file actions
43 lines (35 loc) · 717 Bytes
/
Copy pathstar.cpp
File metadata and controls
43 lines (35 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void print_char(char c, int n)
{
int i;
for (i=1; i<=n; i++)
printf(" %c",c);
}
int main()
{
// vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
// for (const string& word : msg)
// {
// cout << word << " ";
// }
// cout << endl;
int n;
int i;
printf("Input N -> ");
scanf("%d", &n);
for (i=1; i<=n; i++)
{
print_char(' ',n-i);
print_char('*',2*i-1);
putchar('\n');
}
for(i=1;i<=n-1;i++)
{
print_char(' ',i);
print_char('*',2*n-2*i-1);
putchar('\n');
}
}