TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MARIO SEMO
from: KURT KUZBA
date: 1998-05-13 06:41:00
subject: What is CString 2/2

 //   begin   STRCLS.CPP   PUBLIC DOMAIN   ( part 2 of 2 )
void MyStrings::operator=(char cA)
{ char szA[2] = ""; *szA = cA; Mak(szA); }
void MyStrings::operator=(long lA)
{ char buf[32]; sprintf(buf, "%ld", lA); Mak(buf); }
void MyStrings::operator=(unsigned long luA)
{ char buf[32]; sprintf(buf, "%lu", luA); Mak(buf); }
void MyStrings::operator=(double ffA)
{
   char buf[64], format[5] = "%.2f", *tokens = "0123456789";
   format[2] = tokens[dP];
   sprintf(buf, format, ffA);
   Mak(buf);
}
void MyStrings::operator+(char cA)
{ char szA[2] = ""; *szA = cA; Add(szA); }
void MyStrings::operator+(unsigned long luA)
{ char szA[32]; sprintf(szA, "%lu", luA); Add(szA); }
void MyStrings::operator+(long lA)
{ char szA[32]; sprintf(szA, "%ld", lA); Add(szA); }
void MyStrings::operator+(double ffA)
{
   char buf[64], format[5] = "%.2f", *tokens = "0123456789";
   format[2] = tokens[dP];
   sprintf(buf, format, ffA);
   Add(buf);
}
int main(void)
{
   MyStrings Name("Kurt"), Str;
   Str = (short)100;          cout << Str << " ";
   Str = (unsigned short)200; cout << Str << " ";
   Str = (int)300;            cout << Str << " ";
   Str = 400U;                cout << Str << " ";
   Str = 500L;                cout << Str << " ";
   Str = (unsigned long)600;  cout << Str << " ";
   Str = 700.5F;              cout << Str << " ";
   Str = -800.9F;             cout << Str << endl;
   Str = Name;
   Str + " Kuzba ";
   Str + (short)100;          Str + ' ';
   Str + (unsigned short)200; Str + ' ';
   Str + (int)300;            Str + ' ';
   Str + (unsigned)400;       Str + ' ';
   Str + 500L;                Str + ' ';
   Str + 600LU;               Str + ' ';
   Str.Precision(4);
   Str + 700.5f;
   cout << Str << "\n Hit a key, " << Name << endl;
   getch();
   return 0;
}
 //   end   STRCLS.CPP   PUBLIC DOMAIN   ( part 2 of 2 )
---
> ] Their only crime was being delicious........................
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.