Thread: void(); issues
View Single Post
Old 12-14-2002, 01:27 PM   #1 (permalink)
w00t
Totally Inept
 
w00t's Avatar
 
Join Date: Jul 2002
Location: The Great Northwest
Posts: 195
w00t is on a distinguished road
Post void(); issues

I'm having a bit of a problem with the public member function void kill(). I would like to have the program run to the meow() function, then execute the kill() function with the data stored in kill().
I'm thinking that i used bool incorrectly. It tells me that "kill" is never used. Anyways, if anyone understands what i just said and has some idea on how to set void kill() straight, i would be very happy
Thanks in advance for reading this.

Code:
// Deomonstrates declaration of a class and
//definition of an object for that class,

#include <iostream.h> //to display on screen

class Cat
{
	public:
      	int its_age;
        int its_weight;
        meow();
        kill();
        };
void meow()
	{
   		cout <<"Meow.\n";
        }

void kill()
{
      int x;
      bool kill(0,1);
      
      cout <<"Would you like to kill Frisky?\n ";
      cin >>x;

         if(kill = 1);
         {
      	cout <<"Thump! \n";
         }
         if(kill = 0)
         {
         cout <<"Okay. *Swerves* \n";
         }
}

void main()
{
   Cat Frisky;
   Frisky.its_age = 5;			//assigns 5 to int_itsage for cat frisky
   Frisky.its_weight = 15;
   
   cout <<"Frisky is a cat who is "		<<Frisky.its_age	
   << " Years old.\n";
   cout <<"Frisky weighs " 	<<Frisky.its_weight	<<" Pounds.\n ";
   meow();
   kill();
   }
__________________
Office Space:
Best Movie.
Ever.

Contrary to popular belief, the true function of a programmer
is to turn coffee into source code.
w00t is offline   Reply With Quote