error C2562 and return value

This is my ISING MODEL simulation code. I have some problem on void function returning value and return value function. Here is the error that i got while running this program:

1> error C2562: 'outmagnet' : 'void' function returning a value
2> error C2562: 'outmagnet' : 'void' function returning a value
3> IntelliSense: return value type does not match the function type
4> IntelliSense: return value type does not match the function type

Please help me out.


MY C++ CODE IS:
.......................................................................................
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>

#include <iostream>
#include<conio.h>
#include<windows.h>

int sSIZE = 50;
int s[50][50][50];
FILE *fout1, *fout2;
double Temperature = 1.0;

int DeltaU(int, int, int);
void Initialize(void);
void outmagnet(char *);
void outmagnet(char name[])

{
int i, j, k;
fout1 = fopen(name, "wt");
for (i = 0; i<sSIZE; i++)
{
for (j = 0; j<sSIZE; j++)

for (k = 0; k<sSIZE; k++)
fprintf(fout1, "%d ", s[i][j][k]);
fprintf(fout1, "\n");

fclose(fout1);
}

void Initialize(void);

{
int i, j, k;

for (i = 0; i<sSIZE; i++)
for (j = 0; j<sSIZE; j++)
for (k = 0; k<sSIZE; k++)
if (((double)(rand() % 100) / 100)<0.5)
s[i][j][k] = 1;
else
s[i][j][k] = -1;
}

int DeltaU(int i, int j, int k);
{
int top, bottom, left, right, lcorner, rcorner, result;

if (i == 0) top = s[sSIZE - 1][j][k]; else top = s[i - 1][j][k];
if (i == (sSIZE - 1)) bottom = s[0][j][k]; else bottom = s[i + 1][j][k];
if (j == 0) left = s[i][sSIZE - 1][k]; else left = s[i][j - 1][k];
if (j == (sSIZE - 1)) right = s[i][0][k]; else right = s[i][j + 1][k];
if (k == 0) lcorner = s[i][j][sSIZE - 1]; else lcorner = s[i][j][k - 1];
if (k == (sSIZE - 1)) rcorner = s[i][j][0]; else rcorner = s[i][j][k + 1];

result = 2 * s[i][j][k] * (top + bottom + left + right + lcorner + rcorner);

return (result);
}

#ifdef main
#undef main
#endif

int main(int argc, TCHAR* argv[]);
{
int i, j, k, iter, ll, ii, jj, kk, qwe;
double xx, xxx;
long l;

int NetM;

float tp, iter2;

printf("\n Temperature = ");
scanf("%f", &tp);
Temperature = (double)tp;
printf("\n Iterations =");
scanf("%f", &iter2);
iter = (int)iter2;
printf("\f");

srand((unsigned)time(NULL));

Initialize();

outmagnet("zero.txt");
for (ll = 0; ll< iter; ll++)
{
system("cls");
NetM = 0;
for (ii = 0; ii < sSIZE; ii++)
{
for (jj = 0; jj < sSIZE; jj++)
{
{
for (kk = 0; kk<sSIZE; kk++)

if (s[ii][jj][kk]>0)
{
printf("1"); NetM++;
}
else
{
printf("0"); NetM--;
}
}
}
printf("\n");
}
printf("ITERATION NUMBER %d NET MAGNETIZATION %d", ll, NetM);
Sleep(500);
for (qwe = 0; qwe < 100000; qwe++)
xx = exp(-(double)qwe);
//scanf("%f",&iter2);

for (l = 0; l < (long)(sSIZE*sSIZE); l++)
{
i = (int)((int)(rand() % 10000)*sSIZE / 10000);
j = (int)((int)(rand() % 10000)*sSIZE / 10000);
k = (int)((int)(rand() % 10000)*sSIZE / 10000);
if (DeltaU(i, j, k) <= 0)
s[i][j][k] = -s[i][j][k];
else
{
xx = ((double)(rand() % 10000)) / 10000;
xxx = exp(-DeltaU(i, j, k) / Temperature);
if (xx < xxx)
{
s[i][j][k] = -s[i][j][k];
}
}

if (l == (20 * (long)sSIZE*(long)sSIZE))
outmagnet("20.txt");
if (l == (100 * (long)sSIZE*(long)sSIZE))
outmagnet("100.txt");
if (l == (500 * (long)sSIZE*(long)sSIZE))
outmagnet("500.txt");
if (l == (1000 * (long)sSIZE*(long)sSIZE))
outmagnet("1000.txt");
//print("%f \r",(float)l);
}
}

outmagnet("5k.txt");
Sleep(5000);
}
return 0;

system ("PAUSE");
}
....................................................................................
Topic archived. No new replies allowed.