hi guys. im having a hard time figuring this out. could someone help me please?
How could I write the code for
Product of a & b with the use of addition operator only.
Thanks.
hi guys. im having a hard time figuring this out. could someone help me please?
How could I write the code for
Product of a & b with the use of addition operator only.
Thanks.
What have you tried?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Have you not learned anything from posting here in the past? You need to show some effort, this seems to be a recurring problem. Did you learn how to count yet?
I presume a and b are only expected to be non-negative integers. So, choose some such values, substitute and then figure out how you would express that product as addition.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Thank you.
Originally Posted by bummieloveOriginally Posted by laserlightLaser: Your problem solving skills continue to amaze me.Originally Posted by bummielove
I see '*' in that code, which you were forbidden to use, no?
You need to regress back to when you were eight years old and learning what multiplication was for the first time.
So, where did you take that code from? I would like to point out a couple of things:
1. This code has nothing to do with your problem.
2. Do not just post random code and then expect someone to post the correct code for you.
3. Read the homework policy.
He is likely hoping Common Tator posts a good answer again.
Tim S.
@OP: Try this. Write down, in words, the steps you would use to solve this problem. Then share it with us. Then some of us might begin to help you turn it into code.
If you can't write it down in words for us, then this is actually a math-related problem and not a program-related problem.
You have a concrete example, but an example is not an algorithm. Go back to a and b. How would you express a * b using addition, in words?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)