Commit cb9db7be authored by mary.zaqaryan's avatar mary.zaqaryan

Mary Zaqaryan Exercise_05_12 Version1

parent 7b4207e2
#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;
}
}
.file "exercise_05_12.cpp"
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
.section .rodata
.LC0:
.string "*"
.LC1:
.string " "
.text
.globl main
.type main, @function
main:
.LFB1021:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $80, %rsp
movl $1, -80(%rbp)
.L5:
cmpl $10, -80(%rbp)
jg .L2
movl $1, -76(%rbp)
.L4:
movl -76(%rbp), %eax
cmpl -80(%rbp), %eax
jg .L3
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -76(%rbp)
jmp .L4
.L3:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
addl $1, -80(%rbp)
jmp .L5
.L2:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
movl $1, -72(%rbp)
.L9:
cmpl $10, -72(%rbp)
jg .L6
movl $10, -68(%rbp)
.L8:
movl -68(%rbp), %eax
cmpl -72(%rbp), %eax
jl .L7
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
subl $1, -68(%rbp)
jmp .L8
.L7:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
addl $1, -72(%rbp)
jmp .L9
.L6:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
movl $1, -64(%rbp)
.L15:
cmpl $10, -64(%rbp)
jg .L10
movl $1, -60(%rbp)
.L12:
movl -60(%rbp), %eax
cmpl -64(%rbp), %eax
jge .L11
movl $.LC1, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -60(%rbp)
jmp .L12
.L11:
movl $10, -56(%rbp)
.L14:
movl -56(%rbp), %eax
cmpl -64(%rbp), %eax
jl .L13
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
subl $1, -56(%rbp)
jmp .L14
.L13:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
addl $1, -64(%rbp)
jmp .L15
.L10:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
movl $1, -52(%rbp)
.L21:
cmpl $10, -52(%rbp)
jg .L16
movl $10, -48(%rbp)
.L18:
movl -48(%rbp), %eax
cmpl -52(%rbp), %eax
jle .L17
movl $.LC1, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
subl $1, -48(%rbp)
jmp .L18
.L17:
movl $1, -44(%rbp)
.L20:
movl -44(%rbp), %eax
cmpl -52(%rbp), %eax
jg .L19
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -44(%rbp)
jmp .L20
.L19:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
addl $1, -52(%rbp)
jmp .L21
.L16:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
movl $10, -40(%rbp)
movl $1, -36(%rbp)
.L39:
cmpl $10, -36(%rbp)
jg .L22
movl $1, -32(%rbp)
.L24:
movl -32(%rbp), %eax
cmpl -36(%rbp), %eax
jg .L23
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -32(%rbp)
jmp .L24
.L23:
movl -40(%rbp), %eax
movl %eax, -28(%rbp)
.L26:
cmpl $0, -28(%rbp)
jle .L25
movl $.LC1, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
subl $1, -28(%rbp)
jmp .L26
.L25:
movl -40(%rbp), %eax
movl %eax, -24(%rbp)
.L28:
cmpl $0, -24(%rbp)
jle .L27
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
subl $1, -24(%rbp)
jmp .L28
.L27:
movl $1, -20(%rbp)
.L30:
movl -20(%rbp), %eax
cmpl -36(%rbp), %eax
jg .L29
movl $.LC1, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -20(%rbp)
jmp .L30
.L29:
movl $1, -16(%rbp)
.L32:
movl -16(%rbp), %eax
cmpl -36(%rbp), %eax
jg .L31
movl $.LC1, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -16(%rbp)
jmp .L32
.L31:
movl -40(%rbp), %eax
movl %eax, -12(%rbp)
.L34:
cmpl $0, -12(%rbp)
jle .L33
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
subl $1, -12(%rbp)
jmp .L34
.L33:
movl -40(%rbp), %eax
movl %eax, -8(%rbp)
.L36:
cmpl $0, -8(%rbp)
jle .L35
movl $.LC1, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
subl $1, -8(%rbp)
jmp .L36
.L35:
movl $1, -4(%rbp)
.L38:
movl -4(%rbp), %eax
cmpl -36(%rbp), %eax
jg .L37
movl $.LC0, %esi
movl $_ZSt4cout, %edi
call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
addl $1, -4(%rbp)
jmp .L38
.L37:
movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi
movl $_ZSt4cout, %edi
call _ZNSolsEPFRSoS_E
subl $1, -40(%rbp)
addl $1, -36(%rbp)
jmp .L39
.L22:
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1021:
.size main, .-main
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB1030:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
cmpl $1, -4(%rbp)
jne .L43
cmpl $65535, -8(%rbp)
jne .L43
movl $_ZStL8__ioinit, %edi
call _ZNSt8ios_base4InitC1Ev
movl $__dso_handle, %edx
movl $_ZStL8__ioinit, %esi
movl $_ZNSt8ios_base4InitD1Ev, %edi
call __cxa_atexit
.L43:
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1030:
.size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii
.type _GLOBAL__sub_I_main, @function
_GLOBAL__sub_I_main:
.LFB1031:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $65535, %esi
movl $1, %edi
call _Z41__static_initialization_and_destruction_0ii
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1031:
.size _GLOBAL__sub_I_main, .-_GLOBAL__sub_I_main
.section .init_array,"aw"
.align 8
.quad _GLOBAL__sub_I_main
.hidden __dso_handle
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits
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