Hi all,
I am absolutely new to C++ programming. Had a requirement to write a piece of c++ code as part of my project. Tried to write with limited knowledge but ran into several syntax issues. Can someone please help me diagnose them.
Below is the code
************************************************** ***********
Code:
APT_Int32 l_startyear;
APT_Int32 l_startmonth;
APT_Int32 l_endyear;
APT_Int32 l_endmonth;
APT_Int32 l_numberofyears;
APT_Int32 l_numberofmnths;
APT_Int32 l_monthlyvalue;
APT_Int32 l_year_start_value;
APT_Int32 l_mv_jan_1;
APT_Int32 l_mv_feb_1;
APT_Int32 l_mv_mar_1;
APT_Int32 l_mv_apr_1;
APT_Int32 l_mv_may_1;
APT_Int32 l_mv_jun_1;
APT_Int32 l_mv_jul_1;
APT_Int32 l_mv_aug_1;
APT_Int32 l_mv_sep_1;
APT_Int32 l_mv_oct_1;
APT_Int32 l_mv_nov_1;
APT_Int32 l_mv_dec_1;
//----Assign Values to the Local Variables----
l_startyear = in0.start_year;
l_startmonth = in0.start_month;
l_endyear = in0.end_year;
l_endmonth = in0.end_month;
l_numberofyears = in0.number_of_years;
l_numberofmnths = in0.number_of_mnths;
l_monthlyvalue = in0.monthly_value;
l_mv_jan_1 = if((l_startmonth > 1) || (l_numberofyears = 1 && l_endmonth < 1)) { 0 } else l_monthlyvalue;
l_mv_feb_1 = if((l_startmonth > 2) || (l_numberofyears = 1 && l_endmonth < 2)) { 0 } else l_monthlyvalue;
l_mv_mar_1 = if((l_startmonth > 3) || (l_numberofyears = 1 && l_endmonth < 3)) { 0 } else l_monthlyvalue;
l_mv_apr_1 = if((l_startmonth > 4) || (l_numberofyears = 1 && l_endmonth < 4)) { 0 } else l_monthlyvalue;
l_mv_may_1 = if((l_startmonth > 5) || (l_numberofyears = 1 && l_endmonth < 5)) { 0 } else l_monthlyvalue;
l_mv_jun_1 = if((l_startmonth > 6) || (l_numberofyears = 1 && l_endmonth < 6)) { 0 } else l_monthlyvalue;
l_mv_jul_1 = if((l_startmonth > 7) || (l_numberofyears = 1 && l_endmonth < 7)) { 0 } else l_monthlyvalue;
l_mv_aug_1 = if((l_startmonth > 8) || (l_numberofyears = 1 && l_endmonth < 8)) { 0 } else l_monthlyvalue;
l_mv_sep_1 = if((l_startmonth > 9) || (l_numberofyears = 1 && l_endmonth < 9)) { 0 } else l_monthlyvalue;
l_mv_oct_1 = if((l_startmonth > 10) || (l_numberofyears = 1 && l_endmonth < 10)) { 0 } else l_monthlyvalue;
l_mv_nov_1 = if((l_startmonth > 11) || (l_numberofyears = 1 && l_endmonth < 11)) { 0 } else l_monthlyvalue;
l_mv_dec_1 = if((l_startmonth > 12) || (l_numberofyears = 1 && l_endmonth < 12)) { 0 } else l_monthlyvalue;
For(int l_year_start_value=1;l_year_start_value=<l_numberofyears;l_year_start_value++)
{
if ( l_year_start_value = 1)
{
out0.JAN = l_mv_jan_1;
out0.FEB = l_mv_feb_1;
out0.MAR = l_mv_mar_1;
out0.APR = l_mv_apr_1;
out0.MAY = l_mv_may_1;
out0.JUNE = l_mv_jun_1;
out0.JULY = l_mv_jul_1;
out0.AUG = l_mv_aug_1;
out0.SEP = l_mv_sep_1;
out0.OCT = l_mv_oct_1;
out0.NOV = l_mv_nov_1;
out0.DEC = l_mv_dec_1;
writeRecord(0);
}
else
{
out0.JAN = if( l_numberofyears == l_year_start_value && l_endmonth < 1 ) { 0 } else l_monthlyvalue;
out0.FEB = if( l_numberofyears == l_year_start_value && l_endmonth < 2 ) { 0 } else l_monthlyvalue;
out0.MAR = if( l_numberofyears == l_year_start_value && l_endmonth < 3 ) { 0 } else l_monthlyvalue;
out0.APR = if( l_numberofyears == l_year_start_value && l_endmonth < 4 ) { 0 } else l_monthlyvalue;
out0.MAY = if( l_numberofyears == l_year_start_value && l_endmonth < 5 ) { 0 } else l_monthlyvalue;
out0.JUNE = if( l_numberofyears == l_year_start_value && l_endmonth < 6 ) { 0 } else l_monthlyvalue;
out0.JULY = if( l_numberofyears == l_year_start_value && l_endmonth < 7 ) { 0 } else l_monthlyvalue;
out0.AUG = if( l_numberofyears == l_year_start_value && l_endmonth < 8 ) { 0 } else l_monthlyvalue;
out0.SEP = if( l_numberofyears == l_year_start_value && l_endmonth < 9 ) { 0 } else l_monthlyvalue;
out0.OCT = if( l_numberofyears == l_year_start_value && l_endmonth < 10 ) { 0 } else l_monthlyvalue;
out0.NOV = if( l_numberofyears == l_year_start_value && l_endmonth < 11 ) { 0 ) else l_monthlyvalue;
out0.DEC = if( l_numberofyears == l_year_start_value && l_endmonth < 12 ) { 0 ) else l_monthlyvalue;
writeRecord(0);
}
}
************************************************** ***********
below are the errors, might seem simple to you guys but getting to be a little difficult for me to understand. I have spent the last 6 hours trying everything i could have (there was effort ).
************************************************** ***********
Code:
##E TBLD 000000 Subprocess command failed with exit status 256.
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd): In member function
`virtual APT_Status TPUBNPPIBJ405MonRptRecCreate::runLocally()':
Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):42: error: invalid
conversion from `const void*' to `APT_Int32'
##I TBLD 000000 g++ -fPIC -O -I/ford/.p_fedw_dev/fedw/FEDW_DEV/FEDW_DEV_proj/buildop -I/ford/thishost/proj/Ascential/DataStage/PXEngine/include -O -fPIC -Wno-deprecated -c /ford/.p_fedw_dev/fedw/FEDW_DEV/FEDW_DEV_proj/buildop/bosource17608-0.C -o /ford/thishost/proj/Ascential/Projects/FEDW_DEV/scratch/def/bosource17608-0_s.o.
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):45: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):46: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd): At global scope:
Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):47: error: ISO C++
forbids declaration of `l_mv_mar_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):47: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):48: error: ISO C++
forbids declaration of `l_mv_apr_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):48: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):49: error: ISO C++
forbids declaration of `l_mv_may_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):49: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):50: error: ISO C++
forbids declaration of `l_mv_jun_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):50: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):51: error: ISO C++
forbids declaration of `l_mv_jul_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):51: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):52: error: ISO C++
forbids declaration of `l_mv_aug_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):52: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):53: error: ISO C++
forbids declaration of `l_mv_sep_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):53: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):54: error: ISO C++
forbids declaration of `l_mv_oct_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):54: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):55: error: ISO C++
forbids declaration of `l_mv_nov_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):55: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):56: error: ISO C++
forbids declaration of `l_mv_dec_1' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):56: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):58: error: syntax
error before `;' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):59: error: ISO C++
forbids declaration of `For' with no type
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd): In function `int
For(...)':
Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):60: error: `
l_year_start_value' undeclared (first use this function)
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):60: error: (Each
undeclared identifier is reported only once for each function it appears
in.)
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):62: error: `out0'
undeclared (first use this function)
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):62: error: `
l_mv_jan_1' undeclared (first use this function)
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):63: error: `
l_mv_feb_1' undeclared (first use this function)
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):74: error: `
APT_Bop_outCur' undeclared (first use this function)
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):78: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):79: error: syntax
error before `if'
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd): At global scope:
Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):80: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):81: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):82: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):83: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):84: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):85: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):86: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):87: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):88: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):89: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: Per-Record Code (buildop/TPUBNPPIBJ405MonRptRecCreate.opd):90: error: syntax
error before `.' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: bosource17608-0.C:572: error: `APT_Bop_transfers' was not declared in this
scope
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: bosource17608-0.C:572: error: syntax error before `;' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: bosource17608-0.C:572: error: syntax error before `++' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: bosource17608-0.C:579: error: `APT_Bop_outputs' was not declared in this scope
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: bosource17608-0.C:579: error: syntax error before `;' token
##W TBLD 000000 Output from subprocess:
##W TBLD 000000 Output from subprocess: bosource17608-0.C:579: error: syntax error before `++' token
##W TBLD 000000 Output from subprocess:
************************************************** ***********
Please help,
Thanks in Advance.