a C++ question

This is a discussion on a C++ question within the C++ Programming forums, part of the General Programming Boards category; Thx a lot!!! I worte something like this for right shift... int shift_right(int num) { int i = log10(num)+1; //Get ...

  1. #16
    Registered User
    Join Date
    Oct 2001
    Posts
    101
    Thx a lot!!!

    I worte something like this for right shift...

    int shift_right(int num)
    {
    int i = log10(num)+1; //Get number of digits
    int c = num/10; //Get far right digit
    int d = num-(c*10);
    //Add previous far right digit onto left
    num = c + (d*pow(10,i-1));
    return num;

    }


    I've checked it... no bugs... but... just want someone to give me some comments of it......


    Thx!!
    Last edited by DramaKing; 02-12-2002 at 06:13 PM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21