#ifndef __ch1Ex4__card__
#define __ch1Ex4__card__
#include <iostream>
class card
{
public :
card( ) ;
~card( ) ;
int getcard( ) ;
bool setcard( int card) ;
bool setsuit( char suit) ;
char getsuit( ) ;
private :
int card_value;
char suit_type;
} ;
#endif /* defined(__ch1Ex4__card__) */
#include <iostream>
using namespace std;
//#include "card.h"
int main( int argc, const char * argv[ ] )
{
// just creating a class instance for testing.
// Not sure why it is failing.
card test;
for ( int i = 0 ; i < 4 ; i++ ) {
for ( int k = 0 ; k < 13 ; k++ )
{
switch ( i+ 1 ) {
case 1 : cout << "c" ;
break ;
case 2 : cout << "d" ;
break ;
case 3 : cout << "h" ;
break ;
case 4 : cout << "s" ;
break ;
default :
break ;
}
cout << " " ;
switch ( k+ 1 ) {
case 1 : cout << "A" << endl;
break ;
case 11 : cout << "J" << endl;
break ;
case 12 : cout << "K" << endl;
break ;
case 13 : cout << "Q" << endl;
break ;
default :
cout << k+ 1 << endl;
break ;
}
}
}
return 0 ;
}
//#include "card.h"
card:: card ( )
{
card_value = 0 ;
suit_type = NULL ;
}
int card:: getcard ( )
{
return card_value;
}
bool card:: setcard ( int card)
{
card_value = card;
return true ;
}
bool card:: setsuit ( char suit)
{
suit_type = suit;
return true ;
}
char card:: getsuit ( )
{
return suit_type;
}
I2lmbmRlZiBfX2NoMUV4NF9fY2FyZF9fCiNkZWZpbmUgX19jaDFFeDRfX2NhcmRfXwoKI2luY2x1ZGUgPGlvc3RyZWFtPgoKCmNsYXNzIGNhcmQKewpwdWJsaWM6CgljYXJkKCk7Cgl+Y2FyZCgpOwogICAgaW50IGdldGNhcmQoKTsKICAgIGJvb2wgc2V0Y2FyZChpbnQgY2FyZCk7CiAgICBib29sIHNldHN1aXQoY2hhciBzdWl0KTsKICAgIGNoYXIgZ2V0c3VpdCgpOwoKcHJpdmF0ZToKCiAgICBpbnQgY2FyZF92YWx1ZTsKICAgIGNoYXIgc3VpdF90eXBlOwogICAgCn07CgojZW5kaWYgLyogZGVmaW5lZChfX2NoMUV4NF9fY2FyZF9fKSAqLwoKCgoKI2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCi8vI2luY2x1ZGUgImNhcmQuaCIKCgppbnQgbWFpbihpbnQgYXJnYywgY29uc3QgY2hhciAqIGFyZ3ZbXSkKewogICAgLy8ganVzdCBjcmVhdGluZyBhIGNsYXNzIGluc3RhbmNlIGZvciB0ZXN0aW5nLgogICAgLy8gTm90IHN1cmUgd2h5IGl0IGlzIGZhaWxpbmcuCiAgICBjYXJkIHRlc3Q7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCA0OyBpKyspIHsKICAgICAgICBmb3IgKGludCBrID0gMDsgayA8IDEzOyBrKyspCiAgICAgICAgewogICAgICAgICAgICBzd2l0Y2ggKGkrMSkgewogICAgICAgICAgICAgICAgY2FzZSAxOiBjb3V0IDw8ICJjIjsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIGNhc2UgMjogY291dCA8PCAiZCI7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIDM6IGNvdXQgPDwgImgiOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgY2FzZSA0OiBjb3V0IDw8ICJzIjsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgIGNvdXQgPDwgIiAiOwogICAgICAgICAgICBzd2l0Y2ggKGsrMSkgewogICAgICAgICAgICAgICAgY2FzZSAxOiBjb3V0IDw8ICJBIiA8PCBlbmRsOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgY2FzZSAxMTogY291dCA8PCAiSiIgPDwgZW5kbDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIGNhc2UgMTI6IGNvdXQgPDwgIksiIDw8IGVuZGw7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7IAogICAgICAgICAgICAgICAgY2FzZSAxMzogY291dCA8PCAiUSIgPDwgZW5kbDsKICAgICAgICAgICAgICAgICAgICBicmVhazsgCiAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIGNvdXQgPDwgaysxPDwgZW5kbDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICB9CgogICAgCiAgICByZXR1cm4gMDsKfQoKCgoKLy8jaW5jbHVkZSAiY2FyZC5oIgoKY2FyZDo6Y2FyZCgpCnsKICAgIGNhcmRfdmFsdWUgPSAwOwogICAgc3VpdF90eXBlID0gTlVMTDsKCn0KCmludCBjYXJkOjpnZXRjYXJkKCkKewogICByZXR1cm4gY2FyZF92YWx1ZTsKfQpib29sIGNhcmQ6OnNldGNhcmQoaW50IGNhcmQpCnsKICAgIGNhcmRfdmFsdWUgPSBjYXJkOwogICAgcmV0dXJuIHRydWU7Cn0KYm9vbCBjYXJkOjpzZXRzdWl0KGNoYXIgc3VpdCkKewoKICAgIHN1aXRfdHlwZSA9IHN1aXQ7CgogICAgcmV0dXJuIHRydWU7Cn0KY2hhciBjYXJkOjpnZXRzdWl0KCkKewoKICAgIHJldHVybiBzdWl0X3R5cGU7Cn0=
compilation info
prog.cpp: In constructor ‘card::card()’:
prog.cpp:88:15: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
suit_type = NULL;
^
/home/1eiUyw/ccAlmpYy.o: In function `main':
prog.cpp:(.text.startup+0x106): undefined reference to `card::~card()'
prog.cpp:(.text.startup+0x327): undefined reference to `card::~card()'
collect2: error: ld returned 1 exit status
stdout