Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int notas[10][4];
- int medias[10];
- int ibuf = 0;
- char* decformat = "%d";
- char* strformat = "%s";
- char* askstr = "Enter com a nota %d do aluno %d: ";
- char* mediastr = "Media do aluno %d: %d";
- char* aprov = " - Aprovado.\n";
- char* reprov = " - Reprovado.\n";
- char* newline = "\n";
- __asm
- {
- xor ecx,ecx;
- inputloop:
- notaloop:
- mov edi, printf;
- push ecx;
- movzx ebx,ch;
- inc ebx;
- push ebx;
- movzx ebx,cl;
- inc ebx;
- push ebx;
- mov ebx, askstr;
- push ebx;
- call edi;
- add esp,12;
- pop ecx;
- push ecx;
- lea ebx,ibuf;
- push ebx;
- mov ebx,decformat;
- push ebx;
- mov edi,scanf;
- call edi;
- add esp,8;
- pop ecx;
- lea ebx, notas;
- xor eax,eax;
- mov al,4;
- mul cl;
- mov dx,ax;
- mov ax,16;
- mul ch;
- add ax,dx;
- mov edx,ibuf;
- mov [ebx+eax], edx;
- push ecx;
- mov edi,printf;
- mov ebx,newline;
- push ebx;
- call edi;
- add esp,4;
- pop ecx;
- inc cl;
- cmp cl,4;
- jb notaloop;
- mov cl,0;
- inc ch;
- cmp ch,10;
- jb inputloop;
- }
- __asm
- {
- xor ecx,ecx;
- xor edx,edx;
- lea edi, notas;
- sna:
- sn:
- push edx;
- xor eax,eax;
- mov al,4;
- mul cl;
- mov dx,ax;
- mov ax,16;
- mul ch;
- add ax,dx;
- pop edx;
- mov ebx, [edi+eax];
- add edx, ebx;
- inc cl;
- cmp cl,4;
- jb sn;
- lea eax,medias;
- push ecx;
- movzx ecx,ch;
- mov [eax+ecx*4],edx;
- pop ecx;
- xor edx,edx;
- mov cl,0;
- inc ch;
- cmp ch,10;
- jb sna;
- }
- __asm
- {
- mov edi,printf;
- xor ecx,ecx;
- pma:
- lea ebx,medias;
- mov eax,[ebx+ecx*4];
- mov dl,4;
- div dl;
- movzx eax,al;
- cmp eax,60;
- mov ebx,reprov;
- jb ra;
- mov ebx,aprov;
- ra:
- mov esi,ecx;
- push ebx;
- push eax;
- inc ecx;
- push ecx;
- dec ecx;
- mov ebx,mediastr;
- push ebx;
- call edi;
- add esp,12;
- call edi;
- add esp,4;
- mov ecx,esi;
- inc ecx;
- cmp ecx,10;
- jb pma;
- }
- __asm
- {
- mov edi,getchar;
- call edi;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement