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..?

Do you have it set up as a Win32 console application or did you choose Win32 project?

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 !

After some corrections, I manage to do it. Thanks for all the help! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.