code for finding all prime factors of a number using stacks

This is a discussion on code for finding all prime factors of a number using stacks within the C++ Programming forums, part of the General Programming Boards category; OOOOH! Send i to my function(outside of main), then if it returns true push it onto the stack, else don't! ...

  1. #16
    Registered User
    Join Date
    Sep 2007
    Location
    Arizona
    Posts
    164
    OOOOH! Send i to my function(outside of main), then if it returns true push it onto the stack, else don't!
    I am pretty think sometimes in my thinking. I trap myself inside a box and can't seem to break out when I am too close to the problem.

    I was just trying to manipulate my isPrime() to work(?) by returning the numbers instead of doing the 'check' it was intended to do. Cool!

    Thanks! That just might make everything hunky! Awesome.


    That WORKS WORKS WORKS!
    456, returns 19, 3, 2, 1;
    2093, returns 23, 13, 7, 1.
    These factors are ALL prime!
    Thank you so much tabstop. A second brain attacking a problem is always a wonderful thing!
    Last edited by clegs; 11-25-2007 at 03:06 PM.

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

Similar Threads

  1. More fun with the chinese prime number algorigthm
    By kryonik in forum C Programming
    Replies: 4
    Last Post: 09-01-2005, 04:41 PM
  2. Prime Number stops after 29, but why?
    By Daveo in forum C Programming
    Replies: 22
    Last Post: 09-17-2004, 10:55 AM
  3. Homework help
    By Jigsaw in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 04:56 PM
  4. Random Number problem in number guessing game...
    By -leech- in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 04:00 PM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM

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