multiply using << several times

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2009
Posts: 8
Reputation: jloundy has a little shameless behaviour in the past 
Solved Threads: 0
jloundy jloundy is offline Offline
Newbie Poster

Re: multiply using << several times

 
0
  #11
Jun 1st, 2009
@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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 32
Reputation: Ahmed_I is an unknown quantity at this point 
Solved Threads: 1
Ahmed_I Ahmed_I is offline Offline
Light Poster

Re: multiply using << several times

 
-1
  #12
Jun 1st, 2009
If you want to multiply any number by 100
Try this :-

  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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: multiply using << several times

 
0
  #13
Jun 1st, 2009
Originally Posted by jloundy View Post
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.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 8
Reputation: jloundy has a little shameless behaviour in the past 
Solved Threads: 0
jloundy jloundy is offline Offline
Newbie Poster

Re: multiply using << several times

 
-1
  #14
Jun 1st, 2009
shu shu shu shut you mouth
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,625
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 714
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: multiply using << several times

 
0
  #15
Jun 1st, 2009
>shu shu shu shut you mouth
You can dish it out, but you can't take it? That's pretty sad.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: multiply using << several times

 
0
  #16
Jun 1st, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,813
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: multiply using << several times

 
0
  #17
Jun 1st, 2009
For the record, Jephthah, I like your avatar, but I'm having trouble placing it. Is it Stupendousman from Calvin & Hobbes?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: multiply using << several times

 
0
  #18
Jun 1st, 2009
yes
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC