Hello! I'm a newbie here...

Straight to the point, I tried to create a program as stated in the title above musing C++. Below are the code I used:

#include <iostream>
#include <cstdlib>


const board=8;
const pop=20;

using std::cout;
using std::endl;


double table[board][board];
int r;
int c;

int main()

{

	// Initialize random number generator.


	for(r=0; r<pop; r++)//row
	{ 
		for(c=0; c<board; c++)

		table[r][c] = rand() % board-1;

	}

	cout << table[r][c] << endl; //display table


	return 0;

}

but, it fail to link. the error was:

Linking...
LIBCD.lib(wwincrt0.obj) : error LNK2001: unresolved external symbol _wWinMain@16
Debug/test2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

test2.exe - 2 error(s), 0 warning(s)

can someone help me how to solve this..?

erm... I think that is the problem. maybe I've clicked at Win32 application, rather than Win32 console application. I'll change it first and try to see the output.

Anything will be update later. Thanks for the help..

#include <iostream>
#include <stdlib.h>

 int main()
 {  

const int board=8;
const int pop=20; 
using std::cout;
using std::endl; 
double table[board][board];

int r;
int c;

system("pause");
// Initialize random number generator.  

    for(r=0; r<pop; r++)//row
    {       

    for(c=0; c<board; c++)
    { 
        table[r][c] = rand() % 8 -1 ;// % board-1; 

    }   cout << table[r][c] << endl; //display table
    system("pause");    
}

system("pause");
//return 0; 

}

THis worked !

Edited 3 Years Ago by Nick Evan: Fixed formatting

This question has already been answered. Start a new discussion instead.