943,695 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1201
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jun 1st, 2009
0

Re: multiply using << several times

@jephthan
>> go on try it. you might actually learn something.

COOOOOOOOOL, dont be dick dude, im a begineer.
btw sick avatar, what are you 12?
Reputation Points: 5
Solved Threads: 0
Newbie Poster
jloundy is offline Offline
8 posts
since May 2009
Jun 1st, 2009
-1

Re: multiply using << several times

If you want to multiply any number by 100
Try this :-

CPP Syntax (Toggle Plain Text)
  1. int result = 0;
  2. int x;
  3. cout << "Enter Any Number " << endl;
  4. cin>>x;
  5. for ( int i = 1 ; i <= (100 /2) ; i++)
  6. {
  7. result += x << 1;
  8.  
  9. }

if u want to multiply by n just replace 100 with n.
But BEWARE this works when n is even only.
Find by yourself how to overcome this when n is odd.
Last edited by Ahmed_I; Jun 1st, 2009 at 1:51 pm.
Reputation Points: 14
Solved Threads: 1
Light Poster
Ahmed_I is offline Offline
32 posts
since Nov 2008
Jun 1st, 2009
0

Re: multiply using << several times

Click to Expand / Collapse  Quote originally posted by jloundy ...
COOOOOOOOOL, dont be dick dude, im a begineer. btw sick avatar, what are you 12?
funny you didnt qualify your "solution" with the "hey i'm a beginner" disclaimer, why are you falling back on it now?

whatever, if you're a beginner, then don't use this site to give wrong advice to other beginners. a good intention is no substitute for correct code.



.
Last edited by jephthah; Jun 1st, 2009 at 1:59 pm.
Reputation Points: 2143
Solved Threads: 178
Posting Maven
jephthah is offline Offline
2,567 posts
since Feb 2008
Jun 1st, 2009
-1

Re: multiply using << several times

shu shu shu shut you mouth
Reputation Points: 5
Solved Threads: 0
Newbie Poster
jloundy is offline Offline
8 posts
since May 2009
Jun 1st, 2009
2

Re: multiply using << several times

>shu shu shu shut you mouth
You can dish it out, but you can't take it? That's pretty sad.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Jun 1st, 2009
0

Re: multiply using << several times

never mind. i'm done here. the correct solution has been given back on page 1.


.
Last edited by jephthah; Jun 1st, 2009 at 2:39 pm.
Reputation Points: 2143
Solved Threads: 178
Posting Maven
jephthah is offline Offline
2,567 posts
since Feb 2008
Jun 1st, 2009
0

Re: multiply using << several times

For the record, Jephthah, I like your avatar, but I'm having trouble placing it. Is it Stupendousman from Calvin & Hobbes?
Featured Poster
Reputation Points: 2614
Solved Threads: 687
Posting Expert
VernonDozier is offline Offline
5,372 posts
since Jan 2008
Jun 1st, 2009
0

Re: multiply using << several times

yes
Reputation Points: 2143
Solved Threads: 178
Posting Maven
jephthah is offline Offline
2,567 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: help me on this tutorial
Next Thread in C++ Forum Timeline: Expression Evaluator





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC