All pastes #520921 Raw Edit

Something

public cpp v1 · immutable
#520921 ·published 2007-05-30 01:57 UTC
rendered paste body
bool posview::is_quarterly( QString* s ){	if ( s->left(2).toInt() % 3 > 0 ) {			cout << s->right(2).toInt() << " is not quarterly: " << s->right(2).toInt() % 3 << endl;		return false;	} else {		cout << s->right(2).toInt() << " is quarterly: " << s->right(2).toInt() % 3 << endl;		return true;	}}void posview::handle( dbi_class* req ){                contract cntr; // a simple class.  expiration is a QString        cntr.expiration = QString::number( req->Date ).mid( 2, 4 );         // req->Date is type int in YYYYMMDD format        // cntr.expiration is now YYMM format (0706, 0707, 0708, etc.)        if ( is_quarterly( &cntr.expiration ) ) {                // do something        }}// OUTPUT examples// 8 is not quarterly: 2 (true)// 9 is not quarterly: 0 (false)