Commit d9fa70ab authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'exercise_05_12' into 'master'

Exercise 05 12

See merge request bpcarm/trainings2017!1354
parents b6ed422c 78948739
#include <iostream>
int
main()
{
for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= i; j++) {
std::cout << "*";
}
std::cout << std::endl;
};
std::cout << std::endl;
for (int i = 1; i <= 10; i++) {
for (int j = 10; j >= i; j--) {
std::cout << "*";
}
std::cout << std::endl;
};
std::cout << std::endl;
for (int i = 1; i <= 10; i++) {
for (int j = 1; j < i; j++) {
std::cout << " ";
}
for (int k = 10; k >= i; k--) {
std::cout << "*";
}
std::cout << std::endl;
}
std::cout << std::endl;
for (int i = 1; i <= 10; i++) {
for (int j = 10; j > i; j--) {
std::cout << " ";
}
for (int k = 1; k <= i; k++) {
std::cout << "*";
}
std::cout << std::endl;
}
std::cout << std::endl;
int n = 10;
for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= i; j++) {
std::cout << "*";
}
for (int k = n; k >= 1; k--) {
std::cout << " ";
}
for (int j = n; j >= 1; j--) {
std::cout << "*";
}
for (int k = 1; k <= i; k++) {
std::cout << " ";
}
for (int j = 1; j <= i; j++) {
std::cout << " ";
}
for (int k = n; k >= 1; k--) {
std::cout << "*";
}
for (int j = n; j >= 1; j--) {
std::cout << " ";
}
for (int k = 1; k <= i; k++) {
std::cout << "*";
}
std::cout << std::endl;
--n;
}
}
exercise_05_12: exercise_05_12.o | .gitignore
g++ $^ -o $@
exercise_05_12.ii: exercise_05_12.cpp
g++ -E $^ -o $@
exercise_05_12.s: exercise_05_12.ii
g++ -S $^ -o $@
exercise_05_12.o: exercise_05_12.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_12" > $@
removes:
rm *.ii *.s *.o *.out exercise_05_12 .gitignore
test: exercise_05_12
./exercise_05_12 > test.out
diff test.out test.expected > /dev/null 2>&1 && echo PASSED || echo FAILED
*
**
***
****
*****
******
*******
********
*********
**********
**********
*********
********
*******
******
*****
****
***
**
*
**********
*********
********
*******
******
*****
****
***
**
*
*
**
***
****
*****
******
*******
********
*********
**********
* ********** ********** *
** ********* ********* **
*** ******** ******** ***
**** ******* ******* ****
***** ****** ****** *****
****** ***** ***** ******
******* **** **** *******
******** *** *** ********
********* ** ** *********
********** * * **********
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment