1. ## Unconvertable?

Hi all,

I try to convert the following Qbasic into c++ format , but it does not seem to work. Can you help?

The seemingly complex formula works out which month and date Easter Sunday falls into. It works fine in Qbasic, for example 2002 Easter Sunday falls ino March 31st. WW=Month, XX=Easter Day.
It seems to be the rounding problem in my prgram. Once this problem is ironed out a whole calendar of any year can be programmed based on this formula. Thanks for any help.

Here are my C++ and Qbasic codes:
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>

int AA,BB,CC,DD,EE,FF,GG,HH,II,JJ,KK,LL,MM,NN;
int PP,QQ,RR,SS,TT,UU,VV,WW,XX,ZZ;
int Y;

//EASTERDAY:
//DEF FNA(A) = INT(100 * A + .5) / 100
int main()
{
clrscr();
cout<<"Enter year: ";
cin>>Y;
cout.precision(2);
ZZ = int(Y / 19);
AA = floor(((Y / 19 - ZZ) * 19) * 100 +.5) / 100;
BB = int(Y / 100);
CC = floor(((Y / 100 - BB) * 100) * 100 +.5) / 100;
DD = int(BB / 4);
EE = floor(((BB / 4 - DD) * 4) * 100 +.5) / 100;
FF = int((BB + 8) / 25);
GG = floor((((BB + 8) / 25 - FF) * 25) * 100 +.5) / 100;
HH = int((BB + 1 - FF) / 3);
II = floor((((BB + 1 - FF) / 3 - HH) * 3) * 100 +.5) / 100;
JJ = (19 * AA) + (BB + 15) - (DD + HH);
KK = int(JJ / 30);
LL = floor(((JJ / 30 - KK) * 30 ) * 100 +.5) / 100;
MM = int(CC / 4);
NN = floor(((CC / 4 - MM) * 4) * 100 +.5) / 100;
PP = (2 * EE) + (2 * MM) + 32 - (LL + NN);
QQ = int(PP / 7);
RR = floor(((PP / 7 - QQ) * 7) * 100 +.5) / 100;
SS = AA + (11 * LL) + (22 * RR);
TT = int(SS / 451);
UU = floor(((SS / 451 - TT) * 451) * 100 +.5) / 100;
VV = (LL + RR + 114) - (7 * TT);
WW = int(VV / 31);
XX = floor(((VV / 31 - WW) * 31) * 100 +.5) / 100;
cout<<"Month ="<<WW<<"\tEaster Date ="<<(XX+1)<<"\tZZ="<<ZZ<<"\tAA="<<AA;
getch();
return 0;
}

Qbasic prog:

START:
CLS
COLOR 14
PRINT "What year ";
INPUT Y
IF Y < 1 GOTO START
REM========== EASTER DAY=============================================== ======
EASTERDAY:
DEF FNA (A) = INT(100 * A + .5) / 100
ZZ = INT(Y / 19)
AA = FNA((Y / 19 - ZZ) * 19)
BB = INT(Y / 100)
CC = FNA((Y / 100 - BB) * 100)
DD = INT(BB / 4)
EE = FNA((BB / 4 - DD) * 4)
FF = INT((BB + 8) / 25)
GG = FNA(((BB + 8) / 25 - FF) * 25)
HH = INT((BB + 1 - FF) / 3)
II = FNA(((BB + 1 - FF) / 3 - HH) * 3)
JJ = (19 * AA) + (BB + 15) - (DD + HH)
KK = INT(JJ / 30)
LL = FNA((JJ / 30 - KK) * 30)
MM = INT(CC / 4)
NN = FNA((CC / 4 - MM) * 4)
PP = (2 * EE) + (2 * MM) + 32 - (LL + NN)
QQ = INT(PP / 7)
RR = FNA((PP / 7 - QQ) * 7)
SS = AA + (11 * LL) + (22 * RR)
TT = INT(SS / 451)
UU = FNA((SS / 451 - TT) * 451)
VV = (LL + RR + 114) - (7 * TT)
WW = INT(VV / 31)
XX = FNA((VV / 31 - WW) * 31 + 1)

PRINT
PRINT "MONTH="; WW
PRINT "EASTER DAY= "; XX
PRINT
PRINT "ZZ="; ZZ, "AA="; AA, "BB="; BB, "CC="; CC, "DD="; DD, "EE="; EE, "FF="; FF, "GG="; GG,
PRINT "HH="; HH, "II="; II, "JJ="; JJ, "KK="; KK, "LL="; LL, "MM="; MM, "NN="; NN, "PP="; PP,
PRINT "QQ="; QQ, "RR="; RR, "SS="; SS, "TT="; TT, "UU="; UU, "VV="; VV, "WW="; WW, "XX="; XX

END

2. >int AA,BB,CC,DD,EE,FF,GG,HH,II,JJ,KK,LL,MM,NN;
>int PP,QQ,RR,SS,TT,UU,VV,WW,XX,ZZ;
>int Y;

You could just change all these to float:

float AA,BB,CC,DD,EE,FF,GG,HH,II,JJ,KK,LL,MM,NN;
float PP,QQ,RR,SS,TT,UU,VV,WW,XX,ZZ;
float Y;

3. Also, I'm pretty sure it would be considered good style to use an array here.

4. And some damn CODE TAGS!!!!!!!!