#define's Profile User Rating: *****

Reputation: 1519 Grandmaster
Group:
Expert
Active Posts:
5,305 (2.32 per day)
Joined:
19-February 09
Profile Views:
45,863
Last Active:
User is offline May 21 2015 01:05 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
LandRover
Dream Kudos:
0
Expert In:
C/C++

Latest Visitors

Icon   #define has not set their status

Posts I've Made

  1. In Topic: Cant debug this code

    Posted 21 May 2015

    Hi, in your - operator function you create a SodaCan object called temp.

      SodaCan temp = SodaCan( left.my_Contents - right.my_Contents );
    
    


    The constructor with one parameter is called :

    //==================================
    SodaCan::SodaCan( int my_Contents)
    {
    }
    //==================================
    
    


    It does nothing so the amount of contents is not saved.


    The parameter has the same name as a member variable so needs to be changed :

    //==================================
    SodaCan::SodaCan( int contents)
    {
      // ???  ;
    }
    //==================================
    
    



    The temp object could also be created without an assignment :

    SodaCan operator - ( const SodaCan& left, const SodaCan& right )
    {
      SodaCan temp( left.my_Contents - right.my_Contents );
      
      return temp;
    }
    
    



    If your other constructor is made with a default value for the contents :

    SodaCan::SodaCan( string brand, int size, int contents = 0 ) 
    {
        my_Brand = brand;
        my_Size = size;
        my_Contents = contents;
    }
    
    



    Then you can construct the objects in main like so :

        SodaCan myPepsi( "Pepsi", 12);
        SodaCan yourDietCoke("Coke", 12);
        SodaCan bigGulp( "Pepsi", 128);
        SodaCan junk;
    
    


    The main function lacks a return statement.
  2. In Topic: Attempting to sent C++ Code Files.

    Posted 21 May 2015

    Hi, in your first post you show three files, two of which are the exactly same. Is that the actual case with your files?

    Did you Add the sally.cpp file to your project?
  3. In Topic: VISUAL PROLOG help!

    Posted 19 May 2015

    Tell us if you need more help.
  4. In Topic: VISUAL PROLOG help!

    Posted 19 May 2015

    You will need to create another predicate and corresponding clauses. It shouldn't need any parameters.
  5. In Topic: Recursion practice on linear linked lists

    Posted 19 May 2015

    View Postellechm, on 19 May 2015 - 01:21 AM, said:

    Any ideas about the second one, the compare function? How do I recursively compare the first and last nodes' data? I am confused on how to hold on to the value of the first node, traverse to the end to get the last node, and then compare the data. I keep comparing the last node to itself.


    As parameters you can have two node pointers, you pass the head to both but only increment current. So the first is always the same as the head pointer.

    bool compare(node * first, node * current);
    
    

My Information

Member Title:
Duke of Err
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Delta Quadrant
Years Programming:
12
Programming Languages:
C,C++,HTML,CSS

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Comments

Page 1 of 1
  1. Photo

    mireille4U Icon

    30 Apr 2015 - 05:44
    Greeting from mireille i saw your profile today and i became interested in you and i will like to know more about you and if you can mail an email to my mail address (mireille4u@live.com) i will give you my picture.here is my mail address i hope we can move from here.above. Mireille
  2. Photo

    GryphonClaws Icon

    10 Jan 2013 - 01:15
    Thanks #define. I can't believe I missed such a simple detail.
  3. Photo

    raghav.naganathan Icon

    07 Nov 2012 - 20:40
    Dude...before your reputation changes, I would like to tell you that it(729) is a perfect cube :) Cheers :)
Page 1 of 1