Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Did Microsoft slightly change C++ language in 2008?

0 views
Skip to first unread message

ericmatteson...@hotmail.com

unread,
Sep 28, 2008, 10:23:09 PM9/28/08
to
The textbook for the traditional C++ class that I had
in Fall of 2001 at communnity college for
the Microsoft Visual C++ 6.0
C++ compiler had examples like
cout << endl;
that worked with Microsoft Visual C++ 6.0
In 2008 the new Microsoft Visual Studio 2008 Express Edition
C++ no longer supports traditional cout by itself.
Microsoft might have attempted to change the C++
programming language.
On the Microsoft website they had an example similar to
std::cout << std::endl
Then after changing this old C++ calculator program
by using a std:: before every member of the iostream
class it started working.
This new version of C++ calculator program
is called cs085dww.cpp
On start menu programs
Microsoft Visual Studio 2008 C++ tools then
Microsoft Visual Studio command prompt
copy a:\cs085dww.cpp c:
Fix it with notepad if Internet header and trailer are not
remmed out or deleted
then
cl cs085dww.cpp
If it works dir cs085dww.*
should show
cs085dww.cpp
cs085dww.obj
cs085dww.exe
to run it on Windows use
cs085dww.exe after compiling.
<iostream.h> was also changed to <iostream>
cs085dww.cpp is next */
// beginning of program
// cs085dww.cpp version of cs085dwy.cpp
#include<iostream>
// void mackhw(char* margret,int pegwid,void* peggyv);
// char ruth[80];
// char lionel[80];
// int fixit[14];
// --------------------------------------------------
// This cs085dww.cpp is written by Eric Matteson
// permission is granted to copy this source code
// file cs085dww.cpp and to publish it on the
// internet and to use it at least for non profit use.
// cs085dww.cpp main is reverse Polish notation calcultor
// to test class dewey (128 bit floating point numbers).
// To compile and run on Linux
// c++ cs085dww.cpp -o cs085dww.out
// ./cs085dww.out
// ---------------------------------------------------
// zackint is class of 256 bit integer arithmetic
// in slow motion on a 32-bit CPU
class zackint
{
private:
int zisa[8];
public:
zackint()
{
zisa[0]=0;
zisa[1]=0;
zisa[2]=0;
zisa[3]=0;
zisa[4]=0;
zisa[5]=0;
zisa[6]=0;
zisa[7]=0;
}
void zenlarge(int zarger[]);
void zeshrink(int zlower[]);
zackint zacopyr();
int zaddsub(zackint zatiny,const char* zacksa);
int zishifr(const char* zirse);
void zacopyo(zackint zcrumb);
int zandor(zackint zoright,const char* zaocho);
void zacopyt(int zcrumi);
// --------------------------
void operator = (zackint);
void operator = (int);
zackint operator + (zackint);
zackint operator - (zackint);
zackint operator >> (int);
bool operator << (zackint);
bool operator < (zackint);
bool operator <= (zackint sleright);
bool operator > (zackint sgtright);
bool operator >= (zackint sgeright);
bool operator == (zackint);
bool operator != (zackint);
zackint operator & (zackint zanright);
zackint operator | (zackint oriright);
zackint operator * (zackint zmulsra);
zackint operator / (zackint zzadenom);
void vswap(int zswap[]);
void fromfour(int wafour[]);
int lengthenexp(int shortdew[]);
int isaddsubover();
// ------------------------------------
// end of zackint declarations
};
// -------------------------
void zackint::zenlarge(int zarger[])
{
int zargsub,zenlctr,zargterml,zargtermh;
zargsub=0;
zenlctr=0;
while(zenlctr < 8)
{
zargterml=((*this).zisa[zenlctr]) & 65535;
zargtermh=(((*this).zisa[zenlctr]) >> 16) & 65535;
zarger[zargsub]=zargterml;
zarger[zargsub+1]=zargtermh;
zargsub += 2;
zenlctr ++;
}
}
void zackint::zeshrink(int zlower[])
{
int zlowsub,zesctr,zlowl,zlowh;
zlowsub=0;
zesctr=0;
while(zesctr < 8)
{
zlowh=((zlower[zlowsub+1]) & 65535) << 16;
zlowl=(zlower[zlowsub]) & 65535;
(*this).zisa[zesctr]=zlowh | zlowl;
zlowsub += 2;
zesctr ++;
}
}
zackint zackint::zacopyr()
{
int zcactr,zcaterm;
zackint zpyisa;
zcactr=0;
while(zcactr < 8)
{
zcaterm=(*this).zisa[zcactr];
zpyisa.zisa[zcactr]=zcaterm;
zcactr ++;
}
return zpyisa;
}
int zackint::zaddsub(zackint zatiny,const char* zacksa)
{
int saflags,sacarry,sazctr,sabigrz;
// zacksa is s for subtract a for add
int saresu[16];
int sabig[16];
int satiny[16];
// returns integer flag code oring 80h sign
// 40h zero 01h carry
char sazizsa;
sazizsa = *(zacksa + 0);
saflags = 64 + 4 + 2;
sacarry = 0;
(*this).zenlarge(sabig);
zatiny.zenlarge(satiny);
sazctr=0;
while(sazctr < 16)
{
sabigrz=0;
if(sazizsa == 's')
{
sabigrz=sabig[sazctr]-satiny[sazctr];
sabigrz=sabigrz-sacarry;
}
if(sazizsa == 'a')
{
sabigrz=sabig[sazctr]+satiny[sazctr];
sabigrz=sabigrz+sacarry;
}
saresu[sazctr] = sabigrz & 65535;
sacarry=0;
if((sabigrz & 65536) != 0)sacarry=1;
if((saresu[sazctr]) != 0)saflags=6;
sazctr ++;
}
if((sabigrz & 32768) != 0)saflags=saflags+128;
if(sacarry != 0)saflags=saflags+1;
(*this).zeshrink(saresu);
return saflags;
}
int zackint::zishifr(const char* zisrse)
{
int shifrctr,shifrcyo,shifrcyi,shifrcyd,shifzz;
int destrr[16];
int srcrr[16];
char zlsrse,zrsrse;
zlsrse = *(zisrse + 0);
zrsrse = *(zisrse + 1);
shifzz=70;
shifrctr=15;
shifrcyo=0;
if((*this).zisa[7] < 0)
{
if((zlsrse == 's')&&(zrsrse == 'e'))
{
shifrcyo=32768;
}
}
(*this).zenlarge(srcrr);
while(shifrctr >= 0)
{
shifrcyi=shifrcyo;
shifrcyd=srcrr[shifrctr];
shifrcyo=0;
if((shifrcyd & 1) != 0)shifrcyo=32768;
shifrcyd = shifrcyd >> 1;
shifrcyd = shifrcyd + shifrcyi;
destrr[shifrctr]=shifrcyd;
if(shifrcyd != 0)shifzz=6;
shifrctr --;
}
(*this).zeshrink(destrr);
return shifzz;
}
void zackint::zacopyo(zackint zcrumb)
{
int bcactr,bcaterm;
bcactr=0;
while(bcactr < 8)
{
bcaterm = zcrumb.zisa[bcactr];
(*this).zisa[bcactr]=bcaterm;
bcactr ++;
}
}
int zackint::zandor(zackint zoright,const char* zaocho)
{
int ctroa,aoflag,aoterm;
int lashenoa[8];
int rashenoa[8];
char baocho;
baocho = *(zaocho + 0);
ctroa=0;
while(ctroa < 8)
{
lashenoa[ctroa]=(*this).zisa[ctroa];
rashenoa[ctroa]=zoright.zisa[ctroa];
ctroa ++;
}
ctroa=0;
aoflag=70;
while(ctroa < 8)
{
aoterm=0;
if(baocho == 'a')
{
aoterm=lashenoa[ctroa] & rashenoa[ctroa];
}
if(baocho == 'o')
{
aoterm=lashenoa[ctroa] | rashenoa[ctroa];
}
(*this).zisa[ctroa]=aoterm;
if(aoterm != 0)aoflag=6;
ctroa ++;
}
return aoflag;
}
void zackint::zacopyt(int zcrumi)
{
int bcaitr,bcabrut;
bcaitr=1;
bcabrut=0;
if(((*this).zisa[7]) < 0)bcabrut=0-1;
while(bcaitr < 8)
{
(*this).zisa[bcaitr]=bcabrut;
bcaitr ++;
}
(*this).zisa[0]=zcrumi;
}
void zackint::operator = (zackint zeqright)
{
int eiqctr;
int eiqleft[8];
eiqctr=0;
while(eiqctr < 8)
{
eiqleft[eiqctr]=zeqright.zisa[eiqctr];
eiqctr = eiqctr + 1;
}
eiqctr=0;
while(eiqctr < 8)
{
(*this).zisa[eiqctr]=eiqleft[eiqctr];
eiqctr = eiqctr + 1;
}
}
void zackint::operator = (int ieqright)
{
int eiqleft;
eiqleft=ieqright;
(*this).zacopyt(eiqleft);
}
zackint zackint::operator + (zackint zadright)
{
zackint zadleft;
zadleft=(*this).zacopyr();
zadleft.zaddsub(zadright,"a");
return zadleft;
}
zackint zackint::operator - (zackint zsuright)
{
zackint zsuleft;
zsuleft=(*this).zacopyr();
zsuleft.zaddsub(zsuright,"s");
return zsuleft;
}
zackint zackint::operator >> (int issrmany)
{
zackint srzleft;
int issrctr;
issrctr=issrmany;
srzleft=(*this).zacopyr();
while(issrctr > 0)
{
srzleft.zishifr("zl");
issrctr --;
}
return srzleft;
}
bool zackint::operator << (zackint mltright)
{
zackint mltleft;
int mltcy;
bool mltres;
// zackint << zackint is not shift left
// << is much less than using borrow instead of sign
mltres=false;
mltleft=(*this).zacopyr();
mltcy=mltleft.zaddsub(mltright,"s");
if((mltcy & 1) != 0)mltres=true;
return mltres;
}
bool zackint::operator < (zackint sltright)
{
zackint sltleft;
int sltsf;
bool sltres;
sltres=false;
sltleft=(*this).zacopyr();
sltsf=sltleft.zaddsub(sltright,"s");
if((sltsf & 128) != 0)sltres=true;
return sltres;
}
bool zackint::operator <= (zackint sleright)
{
zackint sleleft;
int slesf;
bool sleres;
sleres=false;
sleleft=(*this).zacopyr();
slesf=sleleft.zaddsub(sleright,"s");
if((slesf & 128) != 0)sleres=true;
if((slesf & 64) != 0)sleres=true;
return sleres;
}
bool zackint::operator > (zackint sgtright)
{
zackint sgtleft;
int sgtsf;
bool sgtres;
sgtres=false;
sgtleft=(*this).zacopyr();
sgtsf=sgtleft.zaddsub(sgtright,"s");
if(((sgtsf & 128)==0)&&((sgtsf & 64)==0))sgtres=true;
return sgtres;
}
bool zackint::operator >= (zackint sgeright)
{
zackint sgeleft;
int sgesf;
bool sgeres;
sgeres=false;
sgeleft=(*this).zacopyr();
sgesf=sgeleft.zaddsub(sgeright,"s");
if((sgesf & 128) == 0)sgeres=true;
return sgeres;
}
bool zackint::operator == (zackint yeqright)
{
zackint yeqleft;
int yeqzf;
bool yeqres;
yeqres=false;
yeqleft=(*this).zacopyr();
yeqzf=yeqleft.zaddsub(yeqright,"s");
if((yeqzf & 64) != 0)yeqres=true;
return yeqres;
}
bool zackint::operator != (zackint zneright)
{
zackint zneleft;
int znezf;
bool zneres;
zneres=false;
zneleft=(*this).zacopyr();
znezf=zneleft.zaddsub(zneright,"s");
if((znezf & 64) == 0)zneres=true;
return zneres;
}
zackint zackint::operator & (zackint zanright)
{
zackint zandleft;
zandleft=(*this).zacopyr();
zandleft.zandor(zanright,"a");
return zandleft;
}
zackint zackint::operator | (zackint oriright)
{
zackint orileft;
orileft=(*this).zacopyr();
orileft.zandor(oriright,"o");
return orileft;
}
zackint zackint::operator * (zackint zmulsra)
{
zackint slfacaz,srfacaz,zaprod,zampyone;
zackint zmpyzero,azmpyres;
int mpyictr;
mpyictr=6;
slfacaz=(*this).zacopyr();
srfacaz=zmulsra.zacopyr();
zmpyzero=0;
zampyone=1;
zaprod=zmpyzero;
while((mpyictr & 64) == 0)
{
azmpyres = srfacaz & zampyone;
if(azmpyres != zmpyzero)
{
zaprod=zaprod+slfacaz;
}
slfacaz=slfacaz+slfacaz;
srfacaz = srfacaz >> 1;
if(srfacaz == zmpyzero)mpyictr=70;
}
return zaprod;
}
zackint zackint::operator / (zackint zzadenom)
{
int zdivctr,znegctr,dshlcy;
zackint donstzero,donstone,divsubtrest;
zackint numerdd,denomdd,bignumber;
zackint zfrac;
zdivctr=0;
znegctr=0;
numerdd=(*this).zacopyr();
denomdd=zzadenom.zacopyr();
donstzero=0;
donstone=1;
bignumber=donstzero;
zfrac=donstzero;
if(numerdd < donstzero)
{
numerdd=donstzero-numerdd;
znegctr ++;
}
if(zzadenom < donstzero)
{
denomdd=donstzero-zzadenom;
znegctr ++;
}
while(zdivctr < 256)
{
bignumber=bignumber+bignumber;
zfrac=zfrac+zfrac;
if(numerdd < donstzero)
{
bignumber=bignumber+donstone;
}
numerdd=numerdd+numerdd;
dshlcy=0;
divsubtrest=bignumber-denomdd;
if(bignumber << denomdd)dshlcy=1;
if((dshlcy & 1) == 0)
{
bignumber=divsubtrest;
zfrac=zfrac+donstone;
}
zdivctr ++;
}
if((znegctr & 1) != 0)
{
zfrac=donstzero-zfrac;
}
return zfrac;
}
// bottom of operator /
void zackint::vswap(int zswap[])
{
int vswctr;
int vswtemp[8];
vswctr=0;
while(vswctr < 8)
{
vswtemp[vswctr]=(*this).zisa[vswctr];
vswctr ++;
}
vswctr=0;
while(vswctr < 8)
{
(*this).zisa[vswctr]=zswap[vswctr];
vswctr ++;
}
vswctr=0;
while(vswctr < 8)
{
zswap[vswctr]=vswtemp[vswctr];
vswctr ++;
}
}
void zackint::fromfour(int wafour[])
{
int targfrvs[8];
int frfvsctr,frfvsone;
frfvsctr=4;
frfvsone=0;
if((wafour[3])<0)frfvsone=0-1;
while(frfvsctr < 8)
{
targfrvs[frfvsctr]=frfvsone;
frfvsctr ++;
}
frfvsctr=0;
while(frfvsctr < 4)
{
targfrvs[frfvsctr]=wafour[frfvsctr];
frfvsctr ++;
}
(*this).vswap(targfrvs);
}
int zackint::lengthenexp(int shortdew[])
{
int targlexp[8];
zackint longexpr;
int lexprez,lantpar,lnextexp,ltwenty,lrextexp;
int lnonzero;
longexpr.fromfour(shortdew);
longexpr.vswap(targlexp);
lnonzero=0;
lexprez=0;
while(lexprez < 8)
{
if(targlexp[lexprez] != 0)lnonzero=1;
lexprez=lexprez+1;
}
lrextexp=targlexp[3];
ltwenty=1024*1024;
lexprez=ltwenty-1;
lantpar=lexprez & lrextexp;
lexprez=(lrextexp >> 20) & 2047;
if(lrextexp < 0)lexprez=(2048-lexprez) & 2047;
lnextexp=ltwenty;
if(lrextexp < 0)lnextexp=0-(ltwenty + ltwenty);
if(lnonzero == 0)lnextexp=0;
if(lnonzero == 0)lexprez=0;
targlexp[3]=lnextexp+lantpar;
(*this).vswap(targlexp);
return lexprez;
}
// 116 96+20 opposite of sign bit 0 o.k.
// 117 96+21 simple overflow
int zackint::isaddsubover()
{
zackint iaozb;
int iaxzb[8];
int isaddoverind,addovermaskl,adoleft,adoright;
int adofarright,addovermaskr,addoverterm;
iaozb=(*this).zacopyr();
iaozb.vswap(iaxzb);
addoverterm=iaxzb[3];
isaddoverind=0;
// returns 0 for normal long value
addovermaskl=1024*2048;
addovermaskr=1024*1024;
adoleft=0;
adoright=0;
adofarright=0;
if(addoverterm < 0)adoleft=1;
// adoleft if negative number
if((addoverterm & addovermaskl) != 0)adoright=1;
// adoright if overflow bit 21 set
if((addoverterm & addovermaskr) != 0)adofarright=1;
// adofarright should be opposite of sign
if(adoleft != adoright)isaddoverind=1;
if((adoleft == adoright)&&(adofarright == adoright))
{
isaddoverind=0-1;
// underflow result too small magnitude
}
return isaddoverind;
}
// ----------------------------------------------------
// ----------------------------------------------------
// zackint 8 32 bit integers
// 16 16 bit half integers
// and 65536 carrys
// and 32768 leftmost sign
// and 65535 half integers values
// ------
// actual end of class zackint
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// class dewey list mantissia without leftmost is
// mantissia 20+96 -> 116 bits 115-0
// exponent in short form 126-116
// ----
// lengthened form for floating point
// 10-0 biased seperate exponent. is negative if sign bit.
// 255-128 high sign
// 31 127 regular sign bit
// 31-22 127-118 low sign
// 21 117 overflow bit for addition same as sign
// 20 116 opposite of sign. implied leftmost one bit.
// 19-0 115-0 mantissia
// class dewey calls class zackint
class dewey
{
private:
int hmgreg[4];
public:
dewey()
{
hmgreg[0]=0;
hmgreg[1]=0;
hmgreg[2]=0;
hmgreg[3]=0;
}
void wswap(int wxswap[]);
void dewcopyo(dewey dcrumb);
dewey dewcopyr();
void shortenf(zackint largedz,int expdf);
dewey fpaddsub(dewey fpstiny,char* lp4345);
dewey fpmpysub(dewey dsrfac);
dewey fpdiv(dewey bdenom);
void dfromint(int src20);
int dewcmp(dewey dcmprr);
void operator = (dewey deqrighh);
bool operator < (dewey dewLTrr);
bool operator > (dewey dewGTrr);
bool operator >= (dewey dewGErr);
bool operator <= (dewey dewLErr);
bool operator != (dewey dewNErr);
bool operator == (dewey dewEQrr);
dewey operator + (dewey dewPLrr);
dewey operator - (dewey dewMIrr);
dewey operator * (dewey dewPRrr);
dewey operator / (dewey dewDLrr);
void ctyping(int ctydpoz,const char* ctydchr);
int fcpread(int frpoz,int frwid,int frbase,char* frydc);
int fcsimpwr(int fwpoz,int fwwid,int fwbase,char* fwrdc);
int dprecise(int dprebase,int dprelimit);
int ifromdub();
int decompwr(int dwpoz,int dwmax,int dwbase,
char* dwyyc);
void shove(dewey* dove,int jove);
void unshove(dewey* undove,int uove);
// --
// --
// -- dewey
// end of dewey declarations 592
};
void dewey::wswap(int wxswap[])
{
int wdswap[4];
int wdswctr;
wdswctr=0;
while(wdswctr < 4)
{
wdswap[wdswctr]=wxswap[wdswctr];
wdswctr ++;
}
wdswctr=0;
while(wdswctr < 4)
{
wxswap[wdswctr]=(*this).hmgreg[wdswctr];
wdswctr ++;
}
wdswctr=0;
while(wdswctr < 4)
{
(*this).hmgreg[wdswctr]=wdswap[wdswctr];
wdswctr ++;
}
}
void dewey::dewcopyo(dewey dcrumb)
{
int dcrrctr;
dcrrctr=0;
while(dcrrctr < 4)
{
(*this).hmgreg[dcrrctr]=dcrumb.hmgreg[dcrrctr];
dcrrctr ++;
}
}
dewey dewey::dewcopyr()
{
dewey dddcres;
int dwrrctr;
dwrrctr=0;
while(dwrrctr < 4)
{
dddcres.hmgreg[dwrrctr]=(*this).hmgreg[dwrrctr];
dwrrctr ++;
}
return dddcres;
}
void dewey::shortenf(zackint largedz,int expdf)
{
zackint largetz;
int largedf[8];
int shortarg[4];
int cinda,ciexp,ciparj;
int cidfmask,citemp;
cinda=16384;
cidfmask=(cinda * 64)-1;
cinda=(cinda << 17);
largetz=largedz;
largetz.vswap(largedf);
if(*(largedf + 7) >= 0)cinda=0;
ciexp=expdf & 2047;
if(expdf > 2047)ciexp=2040;
if(*(largedf + 7)< 0)ciexp=2048-ciexp;
ciexp=((ciexp & 2047) << 20);
citemp = *(largedf + 3);
ciparj=citemp & cidfmask;
citemp=cinda+ciexp;
citemp=citemp+ciparj;
*(shortarg + 3) = citemp;
*(shortarg + 2) = *(largedf + 2);
*(shortarg + 1) = *(largedf + 1);
*(shortarg + 0) = *(largedf + 0);
if((ciexp == 0)||(expdf < 2))
{
*(shortarg + 3)=0;
*(shortarg + 2)=0;
*(shortarg + 1)=0;
*(shortarg + 0)=0;
}
(*this).wswap(shortarg);
}
dewey dewey::fpaddsub(dewey fpstiny,char* lp4345)
{
zackint bpasres;
zackint bpabig;
zackint bpstiny;
zackint bpszero;
dewey fbcbig;
dewey fpasres;
int fpabig[4];
int fhstiny[4];
int expleft,expright,lrsel,expres;
int saflags,faslimctr;
char cp4345;
fbcbig=(*this).dewcopyr();
fbcbig.wswap(fpabig);
expleft=bpabig.lengthenexp(fpabig);
fbcbig=fpstiny.dewcopyr();
fbcbig.wswap(fhstiny);
expright=bpstiny.lengthenexp(fhstiny);
cp4345 = *(lp4345 + 0);
// shift smallest exponented number right
// increasing exponent
expres=expleft;
lrsel=2;
faslimctr=0;
if(expright > expres)
{
expres=expright;
lrsel=3;
}
if((lrsel == 2)&&(expright > 0))
{
while((expright < expres)&&(faslimctr < 4096))
{
saflags=bpstiny.zishifr("se");
expright=expright+1;
faslimctr=faslimctr + 1;
}
}
if((lrsel == 3)&&(expleft > 0))
{
// middle of fpaddsub
while((expleft < expres)&&(faslimctr < 4096))
{
saflags=bpabig.zishifr("se");
expleft=expleft+1;
faslimctr = faslimctr + 1;
}
}
if(cp4345 == '+')
{
bpasres = bpabig + bpstiny;
}
if(cp4345 == '-')
{
bpasres = bpabig - bpstiny;
}
// result bpasres too big shift right once
// incrementing exponent once
// -----------------------------------------
// ----------------------------------------
// bpasres too small magnitude shift left
// many times decreasing exponent.
// -------------------------------------------
// -----------------------------------------
// if biasedexponent < 1 mantissia=0 exponent=0
bpszero=0;
if(bpasres == bpszero)expres=0;
faslimctr=0;
if((bpasres.isaddsubover() > 0)&&(expres > 1))
{
saflags=bpasres.zishifr("se");
if(expres < 2047)expres=expres+1;
}
if((bpasres.isaddsubover() < 0)&&(expres > 1))
{
while((bpasres.isaddsubover() < 0)&&(expres > 1))
{
bpasres=bpasres+bpasres;
expres=expres-1;
faslimctr=faslimctr+1;
if(faslimctr > 511)expres=0;
}
}
if(expres < 2)
{
bpasres=0;
expres=0;
}
fpasres.shortenf(bpasres,expres);
return fpasres;
}
// bottom of fpaddsub
dewey dewey::fpmpysub(dewey dsrfac)
{
zackint bpaprod;
zackint tpaprod;
zackint bslfac;
zackint bsrfac;
dewey bscflc;
dewey fpadrod;
int aslfac[4];
int ipaprod[8];
int dshfac[4];
int bslexp,bsrexp,mpyexp,w7cpy,fpmpyctr;
int sc1024,ss512,is1024,is512,fpmdis;
int is256,dfpmctr;
bscflc = (*this).dewcopyr();
bscflc.wswap(aslfac);
bslexp=bslfac.lengthenexp(aslfac);
bscflc=dsrfac.dewcopyr();
bscflc.wswap(dshfac);
bsrexp=bsrfac.lengthenexp(dshfac);
mpyexp=(bslexp + bsrexp)-(1024 + 1);
if(bslexp < 2)mpyexp=0;
if(bsrexp < 2)mpyexp=0;
if(mpyexp < 2)mpyexp=0;
// word 7 of bpaprod ands
// 255 8 bits data
// 256 1 bit implied one not equal to sign
// 512 1 bit unstable should be same as sign
// 1024 1 bit fixed sign check
bpaprod = bslfac * bsrfac;
tpaprod=bpaprod;
tpaprod.vswap(ipaprod);
w7cpy=ipaprod[7];
is1024=0;
is512=0;
is256=0;
// fpmpysub middle
if((w7cpy & 1024) > 0)is1024=1;
if((w7cpy & 512) > 0)is512=1;
if((w7cpy & 256) > 0)is256=1;
if(is1024 != is512)
{
fpmdis=bpaprod.zishifr("se");
mpyexp=mpyexp+1;
}
dfpmctr=0;
while(dfpmctr < 2)
{
tpaprod=bpaprod;
tpaprod.vswap(ipaprod);
w7cpy=ipaprod[7];
is1024=0;
is512=0;
is256=0;
if((w7cpy & 1024) > 0)is1024=1;
if((w7cpy & 512) > 0)is512=1;
if((w7cpy & 256) > 0)is256=1;
if(is1024 == is256)
{
bpaprod=bpaprod+bpaprod;
mpyexp=mpyexp-1;
}
dfpmctr ++;
}
fpmpyctr=0;
while(fpmpyctr < 12)
{
bpaprod=bpaprod+bpaprod;
fpmpyctr=fpmpyctr+1;
}
fpmpyctr=0;
bpaprod.vswap(ipaprod);
dfpmctr=0;
if((ipaprod[7])<0)dfpmctr=0-1;
while(fpmpyctr < 4)
{
ipaprod[fpmpyctr]=ipaprod[fpmpyctr + 4];
ipaprod[fpmpyctr + 4]=dfpmctr;
fpmpyctr=fpmpyctr + 1;
}
bpaprod.vswap(ipaprod);
fpadrod.shortenf(bpaprod,mpyexp);
return fpadrod;
}
// end of fpmpysub
dewey dewey::fpdiv(dewey bdenom)
{
zackint bfrac,bnumer,cdenom,hrumer;
dewey bdvcare,fdvrez;
int cnumer[4];
int sdenom[4];
int irumer[8];
int fracexp,numerexp,denomexp,fdivctr;
int divignore,dqover;
bdvcare=(*this).dewcopyr();
bdvcare.wswap(cnumer);
numerexp=bnumer.lengthenexp(cnumer);
bdvcare=bdenom.dewcopyr();
bdvcare.wswap(sdenom);
denomexp=cdenom.lengthenexp(sdenom);
fracexp=(numerexp+1024+1)-denomexp;
if(numerexp < 2)fracexp=0;
bnumer.vswap(irumer);
fdivctr=3;
while(fdivctr >= 0)
{
irumer[fdivctr + 4]=irumer[fdivctr];
irumer[fdivctr]=0;
fdivctr=fdivctr-1;
}
bnumer.vswap(irumer);
fdivctr=0;
while(fdivctr < 12)
{
divignore=bnumer.zishifr("se");
fdivctr=fdivctr+1;
}
bfrac = bnumer / cdenom;
dqover=bfrac.isaddsubover();
if(dqover > 0)
{
divignore=bfrac.zishifr("se");
fracexp=fracexp+1;
}
if(dqover < 0)
{
bfrac=bfrac+bfrac;
fracexp=fracexp-1;
}
fdvrez.shortenf(bfrac,fracexp);
return fdvrez;
}
// bottom of fpdiv
void dewey::dfromint(int src20)
{
// dfromint is designed to convert small positive
// integers to floating point numbers.
// preferably one digit.
int cdieight[8];
int mchaleneg,mchalesrc;
int cdiexp,cdiror,cdicount,cdiprobe;
int cdjcount,cdjtemp,cdjallow;
dewey dfiirez;
dewey mchalezer;
zackint dfjrez;
cdiexp=0;
while(cdiexp < 4)
{
cdieight[cdiexp]=0;
cdiexp=cdiexp+1;
}
mchalezer.wswap(cdieight);
cdiexp=0;
while(cdiexp < 8)
{
cdieight[cdiexp]=0;
cdiexp=cdiexp+1;
}
cdiexp=0;
mchalesrc=src20;
mchaleneg=0;
if(src20 < 0)
{
mchalesrc=0-src20;
mchaleneg=1;
}
if(mchalesrc > 0)
{
cdiror=1;
cdicount=0;
cdiprobe=mchalesrc;
cdjallow=1;
while(cdjallow > 0)
{
cdjtemp=cdiprobe >> 1;
cdiprobe=cdjtemp;
cdicount=cdicount+1;
if(cdiprobe < 1)cdjallow=0;
}
cdjcount=20-cdicount;
cdiprobe=mchalesrc;
cdjallow=1;
while(cdjallow > 0)
{
cdjtemp=cdiprobe+cdiprobe;
cdiprobe=cdjtemp;
cdjcount=cdjcount-1;
if(cdjcount < 0)cdjallow=0;
}
cdieight[3]=cdiprobe;
cdiexp=(1024+cdicount)+0;
}
dfjrez.vswap(cdieight);
dfiirez.shortenf(dfjrez,cdiexp);
if(mchaleneg != 0)
{
dfiirez = mchalezer.fpaddsub(dfiirez,"-");
}
(*this).dewcopyo(dfiirez);
}
// end of dfromint
int dewey::dewcmp(dewey dcmprr)
{
zackint zcmpt;
zackint rcmpz;
dewey dcmpt;
dewey dcmpl;
int rewcmp[4];
int cewcmp;
cewcmp=0;
dcmpl=(*this).dewcopyr();
dcmpt=dcmpl.fpaddsub(dcmprr,"-");
dcmpt.wswap(rewcmp);
zcmpt.fromfour(rewcmp);
rcmpz=0;
if(zcmpt < rcmpz)cewcmp=0-1;
if(zcmpt > rcmpz)cewcmp=1;
return cewcmp;
}
void dewey::operator = (dewey deqrighh)
{
int ddehleft[4];
int ddehctr;
ddehctr=0;
while(ddehctr < 4)
{
ddehleft[ddehctr]=deqrighh.hmgreg[ddehctr];
ddehctr = ddehctr + 1;
}
ddehctr=0;
while(ddehctr < 4)
{
(*this).hmgreg[ddehctr]=ddehleft[ddehctr];
ddehctr = ddehctr + 1;
}
}
bool dewey::operator < (dewey dewLTrr)
{
dewey dewLTlf;
int dewLTce;
bool dewLTrz;
dewLTlf=(*this).dewcopyr();
dewLTrz=false;
dewLTce=dewLTlf.dewcmp(dewLTrr);
if(dewLTce < 0)dewLTrz=true;
return dewLTrz;
}
bool dewey::operator > (dewey dewGTrr)
{
dewey dewGTlf;
int dewGTce;
bool dewGTrz;
dewGTlf=(*this).dewcopyr();
dewGTrz=false;
dewGTce=dewGTlf.dewcmp(dewGTrr);
if(dewGTce > 0)dewGTrz=true;
return dewGTrz;
}
bool dewey::operator >= (dewey dewGErr)
{
dewey dewGElf;
int dewGEce;
bool dewGErz;
dewGElf=(*this).dewcopyr();
dewGErz=false;
dewGEce=dewGElf.dewcmp(dewGErr);
if(dewGEce > 0)dewGErz=true;
if(dewGEce == 0)dewGErz=true;
return dewGErz;
}
bool dewey::operator <= (dewey dewLErr)
{
dewey dewLElf;
int dewLEce;
bool dewLErz;
dewLElf=(*this).dewcopyr();
dewLErz=false;
dewLEce=dewLElf.dewcmp(dewLErr);
if(dewLEce < 0)dewLErz=true;
if(dewLEce == 0)dewLErz=true;
return dewLErz;
}
bool dewey::operator != (dewey dewNErr)
{
dewey dewNElf;
int dewNEce;
bool dewNErz;
dewNElf=(*this).dewcopyr();
dewNErz=false;
dewNEce=dewNElf.dewcmp(dewNErr);
if(dewNEce > 0)dewNErz=true;
if(dewNEce < 0)dewNErz=true;
return dewNErz;
}
bool dewey::operator == (dewey dewEQrr)
{
dewey dewEQlf;
int dewEQce;
bool dewEQrz;
dewEQlf=(*this).dewcopyr();
dewEQrz=true;
dewEQce=dewEQlf.dewcmp(dewEQrr);
if(dewEQce > 0)dewEQrz=false;
if(dewEQce < 0)dewEQrz=false;
return dewEQrz;
}
dewey dewey::operator + (dewey dewPLrr)
{
dewey dewPLlf;
dewey dewPLrz;
dewPLlf=(*this).dewcopyr();
dewPLrz=dewPLlf.fpaddsub(dewPLrr,"+");
return dewPLrz;
}
// --------------------------------------------
dewey dewey::operator - (dewey dewMIrr)
{
dewey dewMIlf;
dewey dewMIrz;
dewMIlf=(*this).dewcopyr();
dewMIrz=dewMIlf.fpaddsub(dewMIrr,"-");
return dewMIrz;
}
dewey dewey::operator * (dewey dewPRrr)
{
dewey dewPRlf;
dewey dewPRrz;
dewPRlf=(*this).dewcopyr();
dewPRrz=dewPRlf.fpmpysub(dewPRrr);
return dewPRrz;
}
dewey dewey::operator / (dewey dewDLrr)
{
dewey dewDLlf;
dewey dewDLrz;
dewDLlf=(*this).dewcopyr();
dewDLrz=dewDLlf.fpdiv(dewDLrr);
return dewDLrz;
}
void dewey::ctyping(int ctydpoz,const char* ctydchr)
{
dewey ctypeez;
int itypete,itypezz;
char itypess;
itypess = *(ctydchr + ctydpoz);
itypete = (int)itypess;
if(itypete < 0)itypete=itypete+256;
itypezz=47;
if((itypete >= 48)&&(itypete <= 57))itypezz=itypete-48;
if((itypete >= 65)&&(itypete <= 70))itypezz=itypete-55;
if((itypete >= 97)&&(itypete <=102))itypezz=itypete-87;
if((itypete >= 43)&&(itypete <= 46))itypezz=itypete;
// 43 + 44 , 45 - 46 .
ctypeez.dfromint(itypezz);
(*this).dewcopyo(ctypeez);
}
int dewey::fcpread(int frpoz,int frwid,int frbase,char* frydc)
{
dewey fcprez,fcpt,fcpri,fcprase,fcrudase,fcrcst01;
dewey fcrcst45,fcrcst46,fcrcst47,fcrcst00;
dewey dcprase,fcyurm;
int fcprctr,fcprsub,fcprlen,fcprllow,fcprlate;
int frnewpoz,fcrneg;
fcrneg=0;
fcprsub=0;
fcrcst00.dfromint(fcprsub);
fcprsub=1;
fcrcst01.dfromint(fcprsub);
fcprsub=45;
fcrcst45.dfromint(fcprsub);
fcprsub=46;
fcrcst46.dfromint(fcprsub);
fcprsub=47;
fcrcst47.dfromint(fcprsub);
fcprlen=1;
fcprllow=1;
fcprlate=1;
fcprase.dfromint(frbase);
fcrudase = fcrcst01 / fcprase;
fcprctr=0;
fcprez=fcrcst00;
while(fcprllow > 0)
{
fcprsub=fcprctr+(frpoz-1);
fcpt.ctyping(fcprsub,frydc);
if(fcpt < fcrcst47)fcprllow=0;
if(fcprllow > 0)
{
fcprctr ++;
if(fcprctr >= frwid)
{
fcprllow=0;
fcprlen=0;
fcprlate=0;
}
}
}
while((fcprlen > 0)&&(fcprlate > 0))
{
fcprsub=fcprctr+(frpoz-1);
fcpt.ctyping(fcprsub,frydc);
if(fcpt >= fcrcst46)fcprlen=0;
if(fcpt > fcrcst46)fcprlate=0;
if(fcpt == fcrcst46)fcprctr ++;
if(fcpt == fcrcst45)fcrneg=1;
if(fcprlen > 0)
{
if(fcpt < fcprase)
{
fcprez = fcprez * fcprase;
fcprez = fcprez + fcpt;
}
fcprctr ++;
if(fcprctr >= frwid)fcprlen=0;
}
}
if(fcprctr >= frwid)fcprlate=0;
dcprase=fcrudase;
while(fcprlate > 0)
{
fcprsub=fcprctr+(frpoz-1);
fcpt.ctyping(fcprsub,frydc);
if(fcpt >= fcprase)fcprlate=0;
if(fcprlate > 0)
{
fcyurm = dcprase * fcpt;
fcprez = fcprez + fcyurm;
dcprase = dcprase * fcrudase;
fcprctr ++;
if(fcprctr >= frwid)fcprlate=0;
}
}
if(fcrneg > 0)
{
fcyurm = fcrcst00 - fcprez;
fcprez = fcyurm;
}
// ----
(*this).dewcopyo(fcprez);
frnewpoz=fcprctr+1;
return frnewpoz;
}
// bottom of fcpread
int dewey::fcsimpwr(int fwpoz,int fwwid,int fwbase,char* fwrdc)
{
dewey wrthiz,dwrbase,wrudbase;
dewey wrcst00,wrcst01;
dewey wrilop,wriprod,writry;
int dwrexp,dwrsub,dwrctr,dwrsgn;
int dwrilop,dwriver,dwriallow;
// --
dwrbase.dfromint(fwbase);
dwrsgn=43;
dwrsub=0;
wrcst00.dfromint(dwrsub);
dwrsub=1;
wrcst01.dfromint(dwrsub);
wrthiz=(*this).dewcopyr();
if(wrthiz < wrcst00)
{
wrthiz=wrcst00-wrthiz;
dwrsgn=45;
}
dwrexp=0;
wrudbase=wrcst01 / dwrbase;
if((wrthiz < wrudbase)&&(wrthiz > wrcst00))
{
while((wrthiz < wrudbase)&&(dwrexp > (1-2048)))
{
wrthiz=wrthiz*dwrbase;
dwrexp=dwrexp-1;
}
}
// middle of fcsimpwr
if(wrthiz >= wrcst01)
{
while((wrthiz >= wrcst01)&&(dwrexp < 2048))
{
wrthiz=wrthiz/dwrbase;
dwrexp=dwrexp+1;
}
}
// cut here to partially round number up
if(wrthiz > wrcst00)
{
dwrctr=0-1;
writry=wrudbase;
while(dwrctr < fwwid)
{
writry=writry*wrudbase;
dwrctr=dwrctr+1;
}
wrthiz=wrthiz+writry;
}
// end of partial rounding up
dwrctr=0;
if(dwrctr < (fwwid+1))
{
dwrsub=dwrctr+(fwpoz-1);
*(fwrdc + dwrsub)=(char)dwrsgn;
*(fwrdc +(dwrsub+1))=(char)46;
}
dwrctr=2;
while(dwrctr < (fwwid+1))
{
dwrilop=0;
dwriver=0;
dwriallow=1;
while(dwriallow > 0)
{
wrilop.dfromint(dwrilop);
wriprod=wrilop*wrudbase;
writry=wrthiz-wriprod;
if(writry >= wrcst00)dwriver=dwrilop;
if(writry < wrcst00)dwriallow=0;
if(dwriallow > 0)
{
dwrilop=dwrilop+1;
if(dwrilop >= fwbase)dwriallow=0;
}
}
wrilop.dfromint(dwriver);
wriprod=wrilop*wrudbase;
writry=wrthiz-wriprod;
wrthiz=writry*dwrbase;
dwriallow=dwriver+48;
if(dwriver > 9)dwriallow=dwriver+87;
dwrsub=dwrctr+(fwpoz-1);
*(fwrdc+dwrsub)=(char)dwriallow;
dwrctr=dwrctr+1;
}
dwrsub=fwwid+(fwpoz-1)+1;
// change to
dwrsub=dwrexp;
return dwrsub;
}
// end of fcsimpwr
int dewey::dprecise(int dprebase,int dprelimit)
{
dewey lprecise,rprecise,tprecise;
dewey tprebase,udprebase,dpreone;
dewey dprezero;
int dpreactr,dpreallow;
dpreactr=0;
dprezero.dfromint(dpreactr);
lprecise=(*this).dewcopyr();
tprebase.dfromint(dprebase);
dpreactr=1;
dpreone.dfromint(dpreactr);
udprebase=dpreone/tprebase;
dpreactr=0;
dpreallow=1;
if(lprecise < dprezero)lprecise=dprezero-lprecise;
rprecise=lprecise;
while(dpreallow > 0)
{
tprecise=rprecise+lprecise;
if(tprecise == lprecise)dpreallow=0;
if(dpreallow > 0)
{
dpreactr=dpreactr+1;
rprecise=rprecise*udprebase;
if(dpreactr >= dprelimit)dpreallow=0;
}
}
return dpreactr;
}
int dewey::ifromdub()
{
dewey ifdleft,ifdzero,ifdone,ifdtwo,ifdhalf;
int ifdres,ifdctr,ifdneg,ifdexp;
ifdleft=(*this).dewcopyr();
ifdctr=1;
ifdone.dfromint(ifdctr);
ifdctr=2;
ifdtwo.dfromint(ifdctr);
ifdctr=0;
ifdzero.dfromint(ifdctr);
ifdres=0;
ifdneg=0;
if(ifdleft < ifdzero)
{
ifdleft = ifdzero - ifdleft;
ifdneg = 1;
}
ifdhalf = ifdone / ifdtwo;
if(ifdleft >= ifdone)
{
ifdexp=0;
while(ifdleft >= ifdone)
{
ifdleft=ifdleft*ifdhalf;
ifdexp=ifdexp+1;
}
ifdctr=0;
while(ifdctr < ifdexp)
{
ifdres=ifdres+ifdres;
if(ifdleft >= ifdhalf)
{
ifdres=ifdres+1;
ifdleft=ifdleft-ifdhalf;
}
ifdleft=ifdleft+ifdleft;
ifdctr=ifdctr+1;
}
}
if(ifdneg != 0)
{
ifdres=0-ifdres;
}
return ifdres;
}
// bottom of ifromdub
int dewey::decompwr(int dwpoz,int dwmax,int dwbase,
char* dwyyc)
{
dewey womplef,wompexp,wompbase,womptra;
int ddwctr,ddwexp,ddiscard;
int ddleftwid,adwpoz;
ddwctr=1;
womptra.dfromint(ddwctr);
womplef = (*this).dewcopyr();
ddleftwid = womptra.dprecise(dwbase,(dwmax-14))-2;
adwpoz=dwpoz;
ddwexp=womplef.fcsimpwr(adwpoz,ddleftwid,dwbase,dwyyc);
ddwctr=0-2;
ddiscard=ddwctr+ddleftwid+adwpoz;
if(ddiscard > 7)
{
*(dwyyc + ddiscard) = 'E';
}
wompexp.dfromint(ddwexp);
wompbase.dfromint(dwbase);
ddwctr=1;
womptra.dfromint(ddwctr);
while(ddwctr < 6)
{
womptra = womptra * wompbase;
ddwctr = ddwctr + 1;
}
if(ddwexp >= 0)wompexp = wompexp + womptra;
if(ddwexp < 0)wompexp = wompexp - womptra;
ddiscard = wompexp.fcsimpwr(adwpoz+ddleftwid,7,
dwbase,dwyyc);
ddwctr=0;
while(ddwctr < 8)
{
ddiscard=ddwctr+ddleftwid+adwpoz;
*(dwyyc + ddiscard) = *(dwyyc + (ddiscard + 3));
ddwctr=ddwctr+1;
}
ddwctr=0;
ddiscard=ddwctr+ddleftwid+adwpoz-1;
*(dwyyc + (ddiscard + 5)) = '\40';
*(dwyyc + (ddiscard + 6)) = '\40';
*(dwyyc + (ddiscard + 7)) = '\40';
*(dwyyc + (ddiscard + 8)) = '\40';
*(dwyyc + (ddiscard + 9)) = '\40';
*(dwyyc + (ddiscard + 10)) = '\40';
*(dwyyc + (ddiscard + 11)) = '\0';
ddwctr=ddiscard+10;
return ddwctr;
}
void dewey::shove(dewey* dove,int jove)
{
dewey shovel;
int jovectr;
shovel=(*this).dewcopyr();
jovectr=jove-1;
while(jovectr >= 0)
{
*(dove + (jovectr + 1)) = *(dove + jovectr);
jovectr = jovectr -1;
}
jovectr=0;
*(dove + jovectr) = shovel;
}
void dewey::unshove(dewey* undove,int uove)
{
dewey unovel;
int uovectr;
uovectr=0;
unovel = *(undove + uovectr);
while(uovectr < (uove + 1))
{
*(undove + uovectr) = *(undove + (uovectr + 1));
uovectr = uovectr + 1;
}
(*this).dewcopyo(unovel);
}
// end of class dewey
// end of class dewey
// test class dewey
// begin diagnostic section
// void mackhw(char* margret,int pegwid,void* peggyv)
// {
// char* peggyc;
// int mackhctr,mackwsub,mare,mackictr;
// int mackrem,mackout;
// peggyc = reinterpret_cast<char*>(peggyv);
// mackhctr=0;
// mackwsub=0;
// while(mackhctr < pegwid)
// {
// mare = (int)(*(peggyc + mackhctr));
// if(mare < 0)mare=mare+256;
// mackictr=1;
// while(mackictr >= 0)
// {
// mackrem = mare & 15;
// mackout = mackrem + 48;
// if(mackrem > 9)mackout = mackrem + 55;
// *(margret + (mackwsub + mackictr)) = (char)mackout;
// mare = mare >> 4;
// mackictr = mackictr - 1;
// }
// mackwsub = mackwsub + 2;
// mackhctr = mackhctr + 1;
// }
// *(margret + mackwsub) = '\0';
// }
// end of mackhw. mackhw was previously used for debugging.
int main()
{
char lionel[80];
// char ruth[80];
// zackint arnold;
dewey zove[20];
dewey dele,deri,alge,dezero;
int otallow,dtallow,otchk,zize;
otchk=0;
dezero.dfromint(otchk);
zize=20;
otallow=1;
while(otallow > 0)
{
dtallow=0;
while(dtallow < 80)
{
lionel[dtallow]=0;
dtallow = dtallow + 1;
}
dtallow=1;
std::cout << "Test Reverse polish calulator" << std::endl;
std::cout << "for class dewey. number enter" << std::endl;
std::cout << "number enter operation enter" << std::endl;
std::cout << " + - * / q quit" << std::endl;
std::cout << " & change sign " << std::endl;
std::cout << "this cs085dww.cpp was written by Eric Matteson";
std::cout << std::endl;
while(dtallow > 0)
{
std::cout << "enter number or operation" << std::endl;
std::cin.get(lionel,80);
std::cin.ignore(80,'\n');
otchk = (int)lionel[0];
if((otchk < 48)||(otchk > 57))dtallow=0;
if((otchk >= 46)&&(otchk <= 46))dtallow=1;
if(dtallow > 0)
{
otchk=alge.fcpread(1,70,10,lionel);
alge.shove(zove,zize);
}
}
otchk=(int)lionel[0];
if(otchk == (int)'q')otallow=0;
if(otallow > 0)
{
// check operation type
if(otchk == (int)'+')
{
deri.unshove(zove,zize);
dele.unshove(zove,zize);
alge = dele + deri;
alge.shove(zove,zize);
}
// right
// check operation type
if(otchk == (int)'-')
{
deri.unshove(zove,zize);
dele.unshove(zove,zize);
alge = dele - deri;
alge.shove(zove,zize);
}
// right
if(otchk == (int)'&')
{
dele.unshove(zove,zize);
alge = dezero - dele;
alge.shove(zove,zize);
}
// check operation type
if(otchk == (int)'*')
{
deri.unshove(zove,zize);
dele.unshove(zove,zize);
alge = dele * deri;
alge.shove(zove,zize);
}
// right
// check operation type
if(otchk == (int)'/')
{
deri.unshove(zove,zize);
dele.unshove(zove,zize);
alge = dele / deri;
alge.shove(zove,zize);
}
// right
dtallow=0;
while(dtallow < 80)
{
lionel[dtallow]='\0';
dtallow=dtallow+1;
}
otchk=alge.decompwr(1,78,10,lionel);
std::cout << lionel;
std::cout << std::endl;
}
}
return 0;
}
// end of program
/* after end of program

Igor Tandetnik

unread,
Sep 28, 2008, 11:12:50 PM9/28/08
to
<ericmatteson...@hotmail.com> wrote in message
news:2ad52828-c219-4cd7...@8g2000hse.googlegroups.com

> The textbook for the traditional C++ class that I had
> in Fall of 2001 at communnity college for
> the Microsoft Visual C++ 6.0
> C++ compiler had examples like
> cout << endl;
> that worked with Microsoft Visual C++ 6.0
> In 2008 the new Microsoft Visual Studio 2008 Express Edition
> C++ no longer supports traditional cout by itself.

cout is supposed to be in namespace std. In VC6, you've probably used
<iostream.h> header, where it wasn't. This header was obsolete and
deprecated even in VC6 (which itself is 10 years old), and removed in
subsequent versions. You should use <iostream> header (without .h),
which is mandated by the C++ standard and portable between compilers and
platforms.

> Microsoft might have attempted to change the C++
> programming language.
> On the Microsoft website they had an example similar to
> std::cout << std::endl

Add this line

using namespace std;

after #include <iostream>
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Ulrich Eckhardt

unread,
Sep 29, 2008, 4:43:41 AM9/29/08
to
Re to your subject: Impossible. The C++ language is an ISO standard and not
controlled by a single company.

ericmatteson...@hotmail.com wrote:
> The textbook for the traditional C++ class that I had
> in Fall of 2001 at communnity college for
> the Microsoft Visual C++ 6.0
> C++ compiler had examples like
> cout << endl;
> that worked with Microsoft Visual C++ 6.0
> In 2008 the new Microsoft Visual Studio 2008 Express Edition
> C++ no longer supports traditional cout by itself.

Well, the ten years old, pre-standard implementation has been replaced with
something that is closer to the standard.

> On the Microsoft website they had an example similar to
> std::cout << std::endl
> Then after changing this old C++ calculator program
> by using a std:: before every member of the iostream
> class it started working.

Yes, and that is what is required by the standard. If you happen to have any
book that doesn't teach you this, it is probably seriously outdated. Check
it against the reviews at http://accu.org, which is also a good source for
reviews before buying a book.

> <iostream.h> was also changed to <iostream>

Similarly to the 'std::' namespace qualification, <iostream.h> is
pre-standard C++.

> // zackint is class of 256 bit integer arithmetic
> // in slow motion on a 32-bit CPU
> class zackint
> {

[snip 1k5 lines of code. ]

Two things:
1. If you want help on code, condense your code to a minimal example.
Dumping that amount of code at an audience just helps to piss off people,
because it looks like you are just lazy.
2. The code is horrible. You need to get a good(!) book that teaches C++.
Also consider reading alt.comp.lang.learn.c-c++, but firstly make yourself
familiar with Usenet etiquette.

Uli

--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

Ben Voigt [C++ MVP]

unread,
Oct 9, 2008, 9:51:13 AM10/9/08
to
ericmatteson...@hotmail.com wrote:
> The textbook for the traditional C++ class that I had
> in Fall of 2001 at communnity college for
> the Microsoft Visual C++ 6.0
> C++ compiler had examples like
> cout << endl;
> that worked with Microsoft Visual C++ 6.0
> In 2008 the new Microsoft Visual Studio 2008 Express Edition
> C++ no longer supports traditional cout by itself.
> Microsoft might have attempted to change the C++
> programming language.

No, Microsoft did not change the C++ language. They changed their compiler
to match (a lot better anyway) real, ISO-standard C++.


Tim Roberts

unread,
Oct 10, 2008, 11:14:22 PM10/10/08
to

As long as we're being precise, this was not a language or compiler change
at all. This was a change in the organization of the standard library.
That's all.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

0 new messages