I've basically been playing with C++ more and more recently and one thing i've came accross is returning a string?
I tried to declare it in my header file while doing the prototypes and the VS .NET doesn't seem to like it, it was fine when i was using char but now i need to return two characters.
i included the string library so i'm now puzzled.
Code:
#include <string>
using namespace std;
string convert_num(int cnumber) {
string temp;
cnumber = (cnumber%13);
switch (cnumber) {
case 0:
temp = 'K';
break;
case 1:
temp = 'A';
break;
case 2:
temp = '2';
break;
case 3:
temp = '3';
break;
case 4:
temp = '4';
break;
case 5:
temp = '5';
break;
case 6:
temp = '6';
break;
case 7:
temp = '7';
break;
case 8:
temp = '8';
break;
case 9:
temp = '9';
break;
case 10:
temp = '10';
break;
case 11:
temp = 'J';
break;
case 12:
temp = 'Q';
break;
default :
temp = 'K';
break;
}
return temp;
}
and in the head file
Code:
string convert_num(int cnumber);
and yes it is the customary blackjack game that everyone gets asked to do.