标签:style blog class c code java
grade 1 ? 85
percent 1 ? 20
grade 2 ? 75
percent 2 ? 20
grade 3 ? 82
percent 3 ? 60
score is : 81
总评成绩 = (期中成绩×百分比1+实验成绩×百分比2+期末成绩×百分比3)/100
1 ; Example assembly language program -- 2 ; Author: karllen 3 ; Date: revised 5/2014 4 5 .386 6 .MODEL FLAT 7 8 ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD 9 10 INCLUDE io.h ; header file for input/output 11 12 cr EQU 0dh ; carriage return character 13 Lf EQU 0ah ; line feed 14 15 .STACK 4096 ; reserve 4096-byte stack 16 17 .DATA 18 promot1_1 BYTE "grade 1 ? ",0 19 promot1_2 BYTE "percent 1 ? ",0 20 promot2_1 BYTE "grade 2 ? ",0 21 promot2_2 BYTE "percent 2 ? ",0 22 promot3_1 BYTE "grade 3 ? ",0 23 promot3_2 BYTE "percent 3 ? ",0 24 25 value BYTE 11 DUP(?) 26 onec DWORD ? 27 twoc DWORD ? 28 threec DWORD ? 29 30 answer BYTE "score is: " 31 average BYTE 11 DUP(?) 32 BYTE cr,Lf,0 33 .CODE 34 _start: 35 output promot1_1 ;enter first grade and percent 36 input value,11 37 atod value 38 mov onec,eax 39 mov ebx,eax 40 output promot1_2 41 input value,11 42 atod value 43 mul ebx ;calculate first grade*percent 44 mov onec,eax 45 46 47 output promot2_1 ;enter second grade and percent 48 input value,11 49 atod value 50 mov twoc,eax 51 mov ebx,eax 52 output promot2_2 53 input value,11 54 atod value 55 mul ebx ;calculate second grade*percent 56 mov twoc,eax 57 58 59 output promot3_1 ;enter the third grade and percent 60 input value,11 61 atod value 62 mov threec,eax 63 mov ebx,eax 64 output promot3_2 65 input value,11 66 atod value 67 mul ebx ;calculate the third grade and percent 68 mov threec,eax 69 70 add eax,onec ;to calculate sum 71 add eax,twoc 72 add eax,threec 73 74 mov ebx,100 75 div ebx ;to calculate the average 76 77 dtoa average,eax 78 output answer 79 80 INVOKE ExitProcess, 0 ; exit with return code 0 81 82 PUBLIC _start ; make entry point public 83 84 END ; end of source code
测试
标签:style blog class c code java
原文地址:http://www.cnblogs.com/Forever-Kenlen-Ja/p/3734692.html