Thread: Cigarette Smoker problem!!!!

  1. #1
    langdoy
    Guest

    Angry Cigarette Smoker problem!!!!

    Does anyone have a C program that solves the Cigarette Smoker's problem? I would like to see how the problem is worked out. If anyone would be able to post the coding, would be much appreciated. Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Yeah, right
    Straight from the board to your tutor no doubt

  3. #3
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Post your code so we can give you some hints!

  4. #4
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Maybe

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Does anyone have a C program that solves the Cigarette Smoker's problem?

    Are you kidding? The problem is that these smokers don't realize how bad the habit really is! Surely you know that these things take determination and self-control? I'm afraid no program can do this for you. It is similar to students that refuse to do their own homework - addicted to the idea that someone might write their code for them - denying the truth that others cannot help those that cannot help themselves....
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Nice one Sebastiani

  7. #7
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    thanks
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  8. #8
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Code:
    #include <life.h>
    #include <stdinhale.h>
    #include <cancer.h>
    #include <badsmells.h>
    
    int main(void)
    {
    	struct life mylife;
    	
    	CreateNewLife(&mylife);  // And we all know what that function does ;-))
    	
    	while (mylife.Alive)
    	{
    		LiveAYear(&mylife);
    		if (mylife.age > 13 && mylife.peer_pressure > 50)
    			mylife.smoker = TRUE;
    		if (mylife.smoker)
    			SmokeLots(&mylife);
    		if (mylife.Cancer == TRUE)
    			mylife.Alive = FALSE;
    		if (RandomDeath(&mylife))
    			mylife.Alive = FALSE;
    	}
    	
    	if (mylife.smoker)
    		return (EXIT_FAILURE);
    	else
    		return (EXIT_SUCCESS);
    }
    Well........... I was bored...
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  9. #9
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    >>#include <stdinhale.h>

    HAHAHA! That's my favorite part! Good play on words, Hammer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM