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

Reputation: 1352 Grandmaster
Group:
Expert
Active Posts:
4,654 (2.27 per day)
Joined:
19-February 09
Profile Views:
42,821
Last Active:
User is offline 55 minutes ago
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: A little help with my assignment

    Posted 29 Sep 2014

    On your confusion with the two functions.

    Let us say you have a function to check a month is valid, you can use it to check different months :

    int ismonth(int month)
    {
      int valid = 1;
    
      if( month < 1 || month > 12) 
      {
        valid = 0;
      }
    
      return valid;
    }
    
    
    int main()
    {
      int startmonth = 2;
      int endmonth = 5;
    
      if( ismonth(startmonth) && ismonth(endmonth) )
      {
        printf("months ok");
      }
      else
      {
        printf("error with months");
      }
    
      return 0;
    }
    
    
  2. In Topic: segmentation fault (core dumped) in C

    Posted 29 Sep 2014

    Line 7 says you should create a command string that begins with "cut ".

    07   // Create a command string that begins with "cut ", followed by the argument string string above.
    08   char  command[100]=" ";
    
    


    Instead of using system initially, you could print out the command string you have created, to check it is correct.
  3. In Topic: Program crashes when I try to remove item?

    Posted 28 Sep 2014

    You didn't set the iterator it to any value.
  4. In Topic: A little help with my assignment

    Posted 27 Sep 2014

    Hi, you could have

    functions that
    1) check that an inputted date has correct values,
    2) check that an inputted time has correct values,
    3) return the number of days in a month,
    4) check that an end date and time is after a start date and time,

    perhaps a function that
    5) calculates the difference between two dates.
  5. In Topic: Calling a template member function.

    Posted 27 Sep 2014

    Hi, for a class you basically just add the template keyword before it, with any parameters, here T, and use the parameter(s) in the class :

    template<class T>
    class Set
    {
      public:
    	T myitems[] = { item1, item2, item3, item4, item5 };
    
    	void addItems();
    	void removeItems();
    	size_t sizeItems();
    };
    
    
    template<class T>
    void Set<T>::additems()
    {
    }
    
    

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

    GryphonClaws Icon

    10 Jan 2013 - 01:15
    Thanks #define. I can't believe I missed such a simple detail.
  2. 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