Commit dfc9fdd9 authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'Bbranch5.23' into 'master'

Bbranch5.23

See merge request bpcarm/trainings2017!1389
parents 8d100616 36355e81
progname=exercise_05_23
CC=g++
CFLAGS=-Wall -Wextra -Werror -g3
all: test1
debug/$(progname): debug/$(progname).o
$(CC) $(CFLAGS) $< -o $@
debug/%.o: debug/%.s
$(CC) -c $(CFLAGS) $< -o $@
debug/%.s: debug/%.ii
$(CC) -S $(CFLAGS) $< -o $@
debug/%.ii: %.cpp | debug
$(CC) -E $(CFLAGS) $< -o $@
debug:
mkdir -p debug
clean:
rm -r debug Tests/*.out
test%: debug/$(progname)
@./debug/$(progname) < Tests/$@.in > Tests/$@.out 2>&1 || echo "$@ is executing..."
@diff Tests/$@.out Tests/$@.expected && echo PASSED || echo FAILED
.PRECIOUS: debug/%.ii debug/%.s
.SECONDARY: debug/%.ii debug/%.s
*
***
*****
*******
*********
*******
*****
***
*
#include <iostream>
#include <cmath>
int
main()
{
const int RHOMBUS_SIZE = 9;
const int rowLimit = RHOMBUS_SIZE / 2;
for (int row = -rowLimit; row <= rowLimit; ++row) {
const int columnLimit = 4 - std::abs(row);
for (int column = -rowLimit; column <= columnLimit; ++column) {
std::cout << (column < -columnLimit ? " " : "*");
}
std::cout << std::endl;
}
return 0;
}
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