Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

(};|=

Name: Anonymous 2011-10-15 23:44


#include <iostream>

using namespace std;

class funzies {
  public:
    funzies(int value) : value_(value) {}
    ~funzies() {}

    funzies& operator++() {
      value_++;
      return *this;
    }

    funzies& operator++(int) {
      ++value_;
      return *this;
    }

    funzies& operator--() {
      value_--;
      return *this;
    }

    funzies& operator--(int) {
      --value_;
      return *this;
    }



    friend ostream& operator<<(ostream& stream, funzies& self) {
      return stream << self.value_;
    }
  private:
    int value_;
};

int main(int argc, char** argv) {
  funzies funfun(6);
  cout << funfun << endl;
  cout << ++funfun++ << endl;
  cout << ++++funfun++++ << endl;
  cout << ++--funfun--++ << endl;
  cout << --++--++--funfun--++--++-- << endl;
  return 0;
}


output:


6
8
12
12
10

Name: Anonymous 2011-10-15 23:57

(Post truncated.)

Name: Anonymous 2011-10-16 0:16

That was VIP quality!

Name: Anonymous 2011-10-16 1:25

Fuck the postfix operator for having stupid precedence. They should've only made the postfix operator, but given it the precedence of the prefix one.

You don't need to define the destructor if it doesn't do anything.

Name: Anonymous 2011-10-16 1:59

Hah, should have done it in Python!

[code]import funzies[/code[

Name: Anonymous 2011-10-16 1:59

Hah, should have done it in Python!

import funzies

Name: Anonymous 2011-10-16 2:11

>>4

I want to make code that does something look liek:


--***--++--++(--(actor->planner)++--->action(0)++.decide()--

Name: Anonymous 2011-10-16 2:48

[b]EXPERT C++ PROGRAMMING THREAD[/b]

Name: Anonymous 2011-10-16 6:50

>>7
valid brainfuck code

Don't change these.
Name: Email:
Entire Thread Thread List