Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit5bac9d08b1e583d3053148512443c845f644d72c (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-10-29 09:29:40 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-10-29 10:17:09 +0300
Files2c5830b9b748ff2f7b0d298d36329de9cdc8e868
Introduction_to_programming_FMI-5bac9d08b1e583d3053148512443c845f644d72c.tar
Introduction_to_programming_FMI-5bac9d08b1e583d3053148512443c845f644d72c.tar.gz
Introduction_to_programming_FMI-5bac9d08b1e583d3053148512443c845f644d72c.zip
Parentdbd0e310d00c9b87a67f81db102f8a509d3041f6 (diff)
Added missing spaces between keyword and bracket. Added newlines for improved readability.
diff --git a/Sem. 03/Solutions/05. Power_Of_Two.cpp b/Sem. 03/Solutions/05. Power_Of_Two.cpp
index 9cbe442..0a5c88f 100644
--- a/Sem. 03/Solutions/05. Power_Of_Two.cpp
+++ b/Sem. 03/Solutions/05. Power_Of_Two.cpp
@@ -7,7 +7,7 @@ int main()
int n;
cin >> n;
- while(n % 2 == 0 && n > 1)
+ while (n % 2 == 0 && n > 1)
n /= 2;
cout << ((n == 1) ? "true" : "false") << endl;
diff --git a/Sem. 03/Solutions/06. Polynomial_Solutions.cpp b/Sem. 03/Solutions/06. Polynomial_Solutions.cpp
index 375f6ec..ba34792 100644
--- a/Sem. 03/Solutions/06. Polynomial_Solutions.cpp
+++ b/Sem. 03/Solutions/06. Polynomial_Solutions.cpp
@@ -8,9 +8,10 @@ int main()
cin >> a >> b >> c >> d >> e;
double fx;
- for (int x = -100; x <= 100; x++) {
+ for (int x = -100; x <= 100; x++)
+ {
fx = a * x*x*x*x + b * x*x*x + c * x*x + d * x + e;
- if(fx >= 0)
+ if (fx >= 0)
cout << x << " ";
}
cout << endl;
diff --git a/Sem. 03/Solutions/08. Triangle.cpp b/Sem. 03/Solutions/08. Triangle.cpp
index 72fec46..ca25b0e 100644
--- a/Sem. 03/Solutions/08. Triangle.cpp
+++ b/Sem. 03/Solutions/08. Triangle.cpp
@@ -7,10 +7,11 @@ int main()
int n;
cin >> n;
- for(int i = 1; i <= n; i++)
+ for (int i = 1; i <= n; i++)
{
- for(int j = 0; j < i; j++)
+ for (int j = 0; j < i; j++)
cout << "$ ";
+
cout << endl;
}
}
diff --git a/Sem. 03/Solutions/09. Lefthand_Triangle.cpp b/Sem. 03/Solutions/09. Lefthand_Triangle.cpp
index 4d6e9b7..183aea8 100644
--- a/Sem. 03/Solutions/09. Lefthand_Triangle.cpp
+++ b/Sem. 03/Solutions/09. Lefthand_Triangle.cpp
@@ -7,14 +7,14 @@ int main()
int n;
cin >> n;
- for(int i = -n + 1; i < n; i++)
+ for (int i = -n + 1; i < n; i++)
{
int absI = ((i > 0) ? i : -i), number = 0;
- for(int j = n - absI; j > 0; j--)
+ for (int j = n - absI; j > 0; j--)
(number *= 10) += j;
- for(int j = absI; j > 0; j--)
+ for (int j = absI; j > 0; j--)
cout << " ";
cout << number << endl;
diff --git a/Sem. 03/Solutions/10. Spiral_Numbers.cpp b/Sem. 03/Solutions/10. Spiral_Numbers.cpp
index 0b9d2a9..d5579af 100644
--- a/Sem. 03/Solutions/10. Spiral_Numbers.cpp
+++ b/Sem. 03/Solutions/10. Spiral_Numbers.cpp
@@ -7,10 +7,10 @@ int main()
int n;
cin >> n;
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
int previous = i + 1;
- for(int j = 0; j < n; j++)
+ for (int j = 0; j < n; j++)
{
if (j == 0)
cout << previous << " ";
diff --git a/Sem. 03/Solutions/12. Frame.cpp b/Sem. 03/Solutions/12. Frame.cpp
index 3d19376..48ae946 100644
--- a/Sem. 03/Solutions/12. Frame.cpp
+++ b/Sem. 03/Solutions/12. Frame.cpp
@@ -7,10 +7,12 @@ int main()
int n;
cin >> n;
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
cout << ((i == 0 || i == n-1) ? "+" : "|");
for(int j = 0; j < n - 2; j++)
+
+ for (int j = 0; j < n - 2; j++)
cout << "-";
cout << ((i == 0 || i == n-1) ? "+" : "|") << endl;
}
diff --git a/Sem. 03/Solutions/13. Dumbbell.cpp b/Sem. 03/Solutions/13. Dumbbell.cpp
index d59cfac..bc0aad5 100644
--- a/Sem. 03/Solutions/13. Dumbbell.cpp
+++ b/Sem. 03/Solutions/13. Dumbbell.cpp
@@ -9,16 +9,16 @@ int main()
int rowWidth = 5 * n / 2;
int evenness = 1 - n % 2;
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
if (i == 0 || i == n - 1)
{
- for(int j = 0; j < rowWidth; j++)
+ for (int j = 0; j < rowWidth; j++)
cout << ((j == n || j == n + evenness) ? " " : ".");
}
else
{
- for(int j = 0; j < rowWidth; j++)
+ for (int j = 0; j < rowWidth; j++)
cout << ((j == 1 || j == 1 + evenness || j == rowWidth - 2 || j == rowWidth - 2 - evenness) ? " " : ".");
}
cout << endl;
diff --git a/Sem. 03/Solutions/14. Tree.cpp b/Sem. 03/Solutions/14. Tree.cpp
index 411db7f..c6ee5cd 100644
--- a/Sem. 03/Solutions/14. Tree.cpp
+++ b/Sem. 03/Solutions/14. Tree.cpp
@@ -7,19 +7,21 @@ int main()
int n;
cin >> n;
- for(int i = 1; i <= n; i++)
+ for (int i = 1; i <= n; i++)
{
- for(int j = n - i; j > 0; j--)
+ for (int j = n - i; j > 0; j--)
cout << " ";
- for(int j = -i + 1; j < i; j++)
+
+ for (int j = -i + 1; j < i; j++)
cout << i - ((j < 0) ? -j : j);
cout << endl;
}
- for(int i = n - 1; i > 0; i--)
+ for (int i = n - 1; i > 0; i--)
{
for (int j = n - 1; j > 0; j--)
cout << " ";
+
cout << i << endl;
}
}