forked from Almas-Ali/Hacktoberfest_Pattern_Making
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_c++.me
More file actions
110 lines (92 loc) · 1.9 KB
/
read_c++.me
File metadata and controls
110 lines (92 loc) · 1.9 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
c++ Program to Print Square Star Pattern
Write a C++ Program to Print Square Star Pattern with an example. This C++ square pattern program allows us to enter any side of a square. Next, the nested for loops will iterate between 0 and side to print the *.
#include<iostream>
using namespace std;
int main()
{
int i, j, side;
cout << "\nPlease Enter Any Side of Square = ";
cin >> side;
cout << "\n-----Square Star Pattern-----\n";
for (i = 0; i < side; i++)
{
for (j = 0; j < side; j++)
{
cout << "*";
}
cout << "\n";
}
return 0;
}
C++ Program to Print Square Star Pattern 1
This C++ Square Star Pattern example allows the user to enter his/her own symbol. Next, it prints the square pattern of that given character.
#include<iostream>
using namespace std;
int main()
{
int i, j, side;
char ch;
cout << "\nPlease Enter Any Side of Square = ";
cin >> side;
cout << "\nPlease Enter Any Symbol to Print = ";
cin >> ch;
cout << "\n-----Square Pattern-----\n";
for (i = 0; i < side; i++)
{
for (j = 0; j < side; j++)
{
cout << ch;
}
cout << "\n";
}
return 0;
}
Please Enter Any Side of Square = 8
Please Enter Any Symbol to Print = @
-----Square Pattern-----
@@@@@@@@
@@@@@@@@
@@@@@@@@
@@@@@@@@
@@@@@@@@
@@@@@@@@
@@@@@@@@
@@@@@@@@
C++ Program to Print Square Star Pattern using a While loop
#include<iostream>
using namespace std;
int main()
{
int i, j, side;
char ch;
cout << "\nPlease Enter Any Side of Square = ";
cin >> side;
cout << "\nPlease Enter Any Symbol to Print = ";
cin >> ch;
cout << "\n-----Square Pattern-----\n";
i = 0;
while (i < side)
{
j = 0;
while (j < side)
{
cout << ch;
j++;
}
cout << "\n";
i++;
}
return 0;
}
Please Enter Any Side of Square = 9
Please Enter Any Symbol to Print = $
-----Square Pattern-----
$$$$$$$$$
$$$$$$$$$
$$$$$$$$$
$$$$$$$$$
$$$$$$$$$
$$$$$$$$$
$$$$$$$$$
$$$$$$$$$
$$$$$$$$$