汇编语言-计算总平成绩
2014-05-17 23:39
549 查看
计算总评成绩
题目:从键盘输入一同学的期中成绩、实验成绩、期末成绩和它们在总评成绩中分别占的百分比,计算得到该同学的总评成绩,并显示出来。要求:该程序提示输入3个成绩和所占百分比。可参考如下的例子显示:
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
; Example assembly language program -- ; Author: karllen ; Date: revised 5/2014 .386 .MODEL FLAT ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD INCLUDE io.h ; header file for input/output cr EQU 0dh ; carriage return character Lf EQU 0ah ; line feed .STACK 4096 ; reserve 4096-byte stack .DATA promot1_1 BYTE "grade 1 ? ",0 promot1_2 BYTE "percent 1 ? ",0 promot2_1 BYTE "grade 2 ? ",0 promot2_2 BYTE "percent 2 ? ",0 promot3_1 BYTE "grade 3 ? ",0 promot3_2 BYTE "percent 3 ? ",0 value BYTE 11 DUP(?) onec DWORD ? twoc DWORD ? threec DWORD ? answer BYTE "score is: " average BYTE 11 DUP(?) BYTE cr,Lf,0 .CODE _start: output promot1_1 ;enter first grade and percent input value,11 atod value mov onec,eax mov ebx,eax output promot1_2 input value,11 atod value mul ebx ;calculate first grade*percent mov onec,eax output promot2_1 ;enter second grade and percent input value,11 atod value mov twoc,eax mov ebx,eax output promot2_2 input value,11 atod value mul ebx ;calculate second grade*percent mov twoc,eax output promot3_1 ;enter the third grade and percent input value,11 atod value mov threec,eax mov ebx,eax output promot3_2 input value,11 atod value mul ebx ;calculate the third grade and percent mov threec,eax add eax,onec ;to calculate sum add eax,twoc add eax,threec mov ebx,100 div ebx ;to calculate the average dtoa average,eax output answer INVOKE ExitProcess, 0 ; exit with return code 0 PUBLIC _start ; make entry point public END ; end of source code
测试
相关文章推荐
- 汇编语言程序设计,计算比赛成绩
- 实训汇编语言设计——学生的成绩统计
- 汇编语言学生成绩管理系统(一)结构体的使用
- 实训汇编语言设计——学生的成绩统计
- 汇编语言三 设数组ARRAY存储多个8位无符号数据,其中第一个字用于存放数据个数,试编写程序求数组元素之和,将结果存放在AX中,若计算的和超过16位数表示的范围,则给出溢出标志DX=-1,否则D
- nasm汇编语言小程序:计算多个指定位置的Fibonacci值
- 汇编语言四 产生随机数,统计奇数的个数,并计算所有奇数的和
- Linux下汇编语言------计算n的阶乘
- 汇编语言学生成绩管理系统——文件IO
- 汇编语言:在以GRADE为首地址的数组中存放着某班某门课30个学生的成绩。试编写一完整汇编语言程序实现:统计小于60分,60~89分和大于等于90分的学生人数,统计结果分别存放在LOWNUM、MIDD
- Linux-C基础知识学习:C语言作业-将5个学生成绩保存在一个数组中,单独实现一个计算平均成绩的average函数, 在main函数中获取该函数返回的平均值,并打印。
- 根据类Student的定义,创建五个该类的对象,输出每个学生的信息, 计算并输出这五个学生Java语言成绩的平均值,以及计算并输出他们Java语言成绩的最大值和最小值。
- How:汇编语言计算2的n次方的一个实例
- 【语言-汇编】自然常数(e)的计算
- Linux-C基础知识学习:C语言作业-输入某个学生的信息(姓名,年龄,5门功课成绩),计算平均成绩并输出。(待完善)
- 汇编语言理解指针(指针就是汇编的间接寻址,其实就是一个简单方便的运算指令,计算完毕直接就赋值,不是从内存中去取值后赋值)
- 汇编语言 计算 2^3 .
- 汇编语言:输入两个数,不大于30,有提示,比较两个数字,如果相等,计算和,如果不相等,计算平均值,并且都要以2进制的格式输出,按照升序输出,计算两个数字各占和的百分比,并且按照“%”的格式输出。
- 【语言-汇编】圆周率(PI)计算
- 汇编语言计算斐波那契