代写Algorithm for GCD
Programming Assignment 6
There are 2 parts to this assignment, both of which should be implemented in one single menubased program. Do not submit 2 .asm files.
Description:
You will write a program that presents the user with a menu. That menu will provide 3 choices as
defined below.
Main menu
----------------------------------------------
1. Display all primes between 2 and n (max of 10000)
2. Euclid’s Algorithm for GCD
3. Exit
Note: The user must always be prompted for input. All inputs must be error checked.
Part 1(20 points):
1. Write a procedure (GetInt) that accepts an unsigned integer from the user and verifies that the
number is a valid input. It must be in the range 2 to 10000 (inclusive).
2. Write a procedure (FindPrimes) that calculates all prime numbers between the 2 and the user
input integer n.
a. Use the Sieve of Eratosthenes to find all primes between 2 and n. There are many examples
of this online, and pseudocode provided below.
b. Display your results using the procedure PrintResults, outlined in step 3.
c. Do not simply hardcode an array of primes, no credit will be given if this is done. They must
be calculated.
3. Write a procedure (PrintResults) that displays: (1) how many primes are in the range of 2 to n and
(2) lists all primes in the following format. Do not use dumpmem. There should be 7 prime
numbers per line, with the possible exception of the last line. Ensure that your numbers line up
in columns as shown below. A string of 5 spaces will not work.
Example: User input n=25
4. Your program will run using a menu procedure (MainMenu), make sure to check for valid input.
5. After displaying the results of a procedure, pause and wait for a key press to continue.
6. Display the Main Menu each time the user elects to stop the current procedure. Meaning each
time a number is entered, primes are displayed, wait for a keypress to acknowledge this, and ask the
user if they would like to input another number or return to the main menu.
Pseudocode for the Sieve of Eratosthenes
Start with a boolean array is_prime of an appropriate size, all initialized to
true (1).
For each i from 2 to 5000, do
If is_prime[i] is true,
For each m from i2 to 5000, step i
set is_prime[m] to false (0)
Part 2(20 points):
Write a recursive implementation of Euclid’s Algorithm for finding the greatest common divisor
(GCD) of two integers. You can find pseudocode for this algorithm online(be sure to cite in your
program where you found pseudocode if any is used). The output shall be of the following format:
Specifications:
1. Do not use USES.
2. Error check after each input. All numbers should be unsigned in part 1, part 2 may use
signed numbers. No number greater than 10000 should be entered.
3. Do not use any . directives(.if, .while, .else, etc.).
4. You must use a recursive algorithm for part 2.
5. Remember your procedures should accomplish a basic task, so you may write more
procedures than just those outlined above.
6. Pass variables to procedures using the Stack. Variables are placed on the stack before
calling the procedure.
7. Remember that you can create local variables, but they are scoped to the procedure they
are defined in.
8. All labels must be unique. This includes data labels and code labels. Do not reuse labels.
9. Style is important. Write clean readable code with sufficient commenting.
10. Make sure your program compiles before submitting it.
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 深圳科华荣获2024“北极星杯”两项行业大奖!
- 北京爱尔英智眼科医院范春雷为母子俩施眼外斜手术,眼病、心病都好了!
- 成功博主分享 WhatsApp拉群营销工具的魔力 让业务成果显著提升
- 专业人士请教 WhatsApp拉群营销工具的使用经验 有人愿意分享吗
- WhatsApp最稳群发协议/ws代发/ws协议号/ws接粉
- 同有科技全新一代自主可控全闪分布式存储震撼发布
- 石阡生态农业平台:绿色生态,共享健康新生活
- 新突破!同仁堂健康冻干冬虫夏草(人工抚育)奢耀献市
- 雪浪云“工业数据+工业机理”驱动的智能制造数字底座系统,助力制造业高质量发展
- 跨境电商 Line 群发云控 虚拟商城的幻境
- 电报群发营销高效工具,Telegram全自动群发软件,TG拉群助推器
- TG自动化群发拉群方案,电报精准营销软件,Telegram快速采集工具
- instagram营销推广新软件!Ins博主推荐群发打粉软件,Instagram利器分享!
- 九章云极DataCanvas公司出席WBBA 2024宽带发展大会
- Telegram协议号注册器,WS智能推广工具,带您走向网络通信的新高度
- Instagram群发市场爆发,ins解封养号利器即将揭晓!
- 电报群发提高转化软件,Telegram自动化营销工具,TG群发拉群系统
- Telegram超好用的批量群发营销软件,电报群发工具推荐
- 前希腊公使见面会把脉希腊移民政策,多房源大优惠多豪礼
- instagram新人营销引流怎样做?ins群发营销引流工具推荐
- Telegram代拉群,品牌推广新利器,Telegram营销软件工具,点燃我生意的喜悦之火
- 吉因加助力科技重大专项,胃癌个性化新抗原肿瘤疫苗研究谱新章
- 佛山市政数局与新点软件签署联合创新开发协议
- 春节休市为什么基金还有收益?
- Ins群发营销工具,Instagram营销软件,助你一步登上营销巅峰!
- 热血开局 2024DMS中国职业赛在上海成功举办
- WhatsApp协议号注册器,智能推广工具,带您走向网络通信的新高度
- 精准匹配TG-WS-LINE频道号,直登号,协议号,老号:代筛全球app助您找到最匹配的数据
- 明牌珠宝——刘涛春日新形象,中国浪漫,蝶恋花开
- 低封控软件推荐!Instagram自动私信营销助手,Ins引流轻松搞定!
推荐
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技