Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.

Get a Professional Answer

Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.

100% Satisfaction Guarantee

Rate the answer you receive.

Ask Raj Your Own Question

Raj, Engineer

Category: Homework

Satisfied Customers: 1271

Experience: 4 + Experiance in IT Industry

16752232

Type Your Homework Question Here...

Raj is online now

IntroductionOne of the earliest known computing devices

Resolved Question:

Introduction

One of the earliest known computing devices consisted of a set of wooden sticks with numbers carved into them like this:+-------------------+ |0 1 2 3 4 5 6 7 8 9| +-------------------+To perform an addition such as 3+4, two sticks can be placed side-by-side, with the '0' of the upper stick next to the '3' of the lower stick. The result of the computation can then be read off by looking for the number on the lower stick which lines up with the '4' on the upper stick:+-------------------+ |0 1 2 3 4 5 6 7 8 9| +-----+-------------+-----+ |0 1 2 3 4 5 6 7 8 9| +-------------------+ ^

Stage 1: Addition

Write a C program which reads an integer, a character, and another integer from standard input, and prints to standard output a picture of the corresponding computing stick computation, in the format shown above. Note:

the two integers will be between 1 and 9 (inclusive)

the horizontal and vertical edges of the sticks should be drawn using the characters '-' and '|'

the corners of the sticks should be drawn as '+'

an up-arrow '^' should be printed to point to the result of the computation

your program should not print any tabs; it should only print spaces ' ', and it should not print any additional blank spaces at the end of any line

the order of the numbers is important; the computation for 4+3 should look different from that of 3+4

when the result is larger than 9, two sticks should be placed next to each other; for example, the result of 5+8 should look like this: +-------------------+ |0 1 2 3 4 5 6 7 8 9| +---------+---------+---------+---------+ |0 1 2 3 4 5 6 7 8 9|0 1 2 3 4 5 6 7 8 9| +-------------------+-------------------+ ^

Stage 2: Subtraction

Now extend your program to handle subtraction. For example, in order to compute 7-5, the '5' of the upper stick should line up with the '7' of the lower stick, and the up-arrow '^' should line up with the '0' of the upper stick, thus pointing to the result on the lower stick:

+-------------------+ |0 1 2 3 4 5 6 7 8 9| +---+---------------+---+ |0 1 2 3 4 5 6 7 8 9| +-------------------+ ^In situations where the result is negative, a down-arrow should be printed above the top stick. For example, the computation for 5-7 should look like this (indicating that the result is negative 2):v +-------------------+ |0 1 2 3 4 5 6 7 8 9| +---+---------------+---+ |0 1 2 3 4 5 6 7 8 9| +-------------------+

Stage 3: Multiplication

The computing-stick method can also be extended to multiplication. As an illustration, we explain in detail the computation of 3*5

Place one stick vertically on the left side of the workspace.

Place 5 sticks horizontally, lining up with the 0, 1, 2, 3 and 4 of the vertical stick; the 0 of each new stick should line up vertically with the 3 of the previous stick.

Place a series of sticks horizontally, lining up with the 5 of the vertical stick, until you reach the 3 of the stick in the row above. Print an up-arrow ^ to point to whatever number lines up with the 3 on that stick.

The result of the computation will generally be a two digit number. The last digit is the one pointed to by the up-arrow (in this case 5). The first digit is the number of (whole) sticks to the left of the up-arrow (in this case 1). Thus, the result of the multiplication is 15.

Hello. I am a moderator for this topic. Unfortunately, the prior professional is unavailable to answer. I have reopened your question to all the professionals for this topic and marked it high priority. You will receive an email notification as soon as you have a new reply. Thank you for your patience.

UPDATE: Multiplication is also ready. Just formatting result is stuck. I am working on it. Effort required to solve it was way more than question price so I have sent an underprice report indicating new price. Please go through it and see whether that's fine with you?

I can't compile this file,this is the wrong message.can you help me, and can you make comments for some of part to let me to easy to understand.Thank you a lots.

One more problem,after each operation I have to press enter then the operation finish,can you help me to fix it up,please,Thank you Thank you Thank you so so much.

THIS ANSWER IS LOCKED! You can view this answer by clicking here to Register or Login and paying $3. If you've already paid for this answer, simply Login.

Are you online ,it's just the programming you gave to me has a little problem, mainly is Multiplication operation. can you help me to fix it up.I have to pass the test for, 2*9,9*1,4*2,2*5,5*3,3*6,it is just slightly different,please help me.

Attachments are only available to registered users.

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.

JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.

Web sites like justanswer.com/legal ...leave nothing to chance.

Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.

Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.

I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C.Freshfield, Liverpool, UK

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. RobinElkton, Maryland

He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here.DianeDallas, TX