The following error appears for the code I'm writing:
error C2062: type 'int' unexpected
C:\Program Files\Microsoft Visual
Studio\MyProjec ts\Valid\Zenith 124\Zenith.cpp( 427) : error C2143:
syntax error : missing ';' before '{'
C:\Program Files\Microsoft Visual
Studio\MyProjec ts\Valid\Zenith 124\Zenith.cpp( 427) : error C2447:
missing function header (old-style formal list?)
Error executing cl.exe.
Zenith.obj - 3 error(s), 0 warning(s)
All errors are related to the function definition, all structures are
global declared and I tried decalring the variable check_digit with no
success.
Those that have responded in the past may already have seen this code
and it would be a pleasure to hear from you again.
struct sum {
int calculation[5];
int calc[6];
int weight_factor[4];
};
union records {
struct file1 rec;
struct file2 rec1;
struct file3 rec2;
struct sum check;
};
int check_mod(union records, int check_digit);// function prototype.
function defintion.
int check_mod(files , int check_digit)
{
check.calculati on[5] =
(sizeof(check.c alculation)/sizeof(check.ca lculation[0]));
for(count = 0; count < 5; count++)
{
check.calculati on[1] = check.weight_fa ctor[1] *
files.rec1.part _num[1];
check.calculati on[2] = check.weight_fa ctor[2] *
files.rec1.part _num[2];
check.calculati on[3] = check.weight_fa ctor[3] *
files.rec1.part _num[3];
check.calculati on[4] = check.weight_fa ctor[4] *
files.rec1.part _num[4];
check.calculati on[5] = check.weight_fa ctor[5] *
files.rec1.part _num[5];
check.calculati on[6] = check.weight_fa ctor[6] *
files.rec1.part _num[6];
};
result = (sizeof(result)/sizeof(check.ca lculation[0]));
while(count++)
{
result = check.calculati on[1] + check.calculati on[2] +
check.calculati on[3] + check.calculati on[4] + check.calculati on[5];
};
remainder = result % mod;
check_digit = mod - remainder;
if(check_digit + remainder == mod)
{
ok = true;
error = false;
}
else
{
ok = false;
error = true;
};
if(ok = true)
{
outfile.write(( &value), sizeof(files.re c.customer_code ));
};
};
error C2062: type 'int' unexpected
C:\Program Files\Microsoft Visual
Studio\MyProjec ts\Valid\Zenith 124\Zenith.cpp( 427) : error C2143:
syntax error : missing ';' before '{'
C:\Program Files\Microsoft Visual
Studio\MyProjec ts\Valid\Zenith 124\Zenith.cpp( 427) : error C2447:
missing function header (old-style formal list?)
Error executing cl.exe.
Zenith.obj - 3 error(s), 0 warning(s)
All errors are related to the function definition, all structures are
global declared and I tried decalring the variable check_digit with no
success.
Those that have responded in the past may already have seen this code
and it would be a pleasure to hear from you again.
struct sum {
int calculation[5];
int calc[6];
int weight_factor[4];
};
union records {
struct file1 rec;
struct file2 rec1;
struct file3 rec2;
struct sum check;
};
int check_mod(union records, int check_digit);// function prototype.
function defintion.
int check_mod(files , int check_digit)
{
check.calculati on[5] =
(sizeof(check.c alculation)/sizeof(check.ca lculation[0]));
for(count = 0; count < 5; count++)
{
check.calculati on[1] = check.weight_fa ctor[1] *
files.rec1.part _num[1];
check.calculati on[2] = check.weight_fa ctor[2] *
files.rec1.part _num[2];
check.calculati on[3] = check.weight_fa ctor[3] *
files.rec1.part _num[3];
check.calculati on[4] = check.weight_fa ctor[4] *
files.rec1.part _num[4];
check.calculati on[5] = check.weight_fa ctor[5] *
files.rec1.part _num[5];
check.calculati on[6] = check.weight_fa ctor[6] *
files.rec1.part _num[6];
};
result = (sizeof(result)/sizeof(check.ca lculation[0]));
while(count++)
{
result = check.calculati on[1] + check.calculati on[2] +
check.calculati on[3] + check.calculati on[4] + check.calculati on[5];
};
remainder = result % mod;
check_digit = mod - remainder;
if(check_digit + remainder == mod)
{
ok = true;
error = false;
}
else
{
ok = false;
error = true;
};
if(ok = true)
{
outfile.write(( &value), sizeof(files.re c.customer_code ));
};
};
Comment