I am writing my program for the bullseye dartboard question I posted in another thread. The link is here. Anyways once I debug, it brings up 2 errors that read:
LNK2019 Error: unresolved external symbol _main referenced in function _tmainCRTStartup
and the file is MSVCRTD.lib

and the other error is:
fatal error LNK1120:1 unresolved externals
and the file is bullseye.exe

here is my code:

#include <iostream>
using namespace std;
#include <cmath>
#include <stdlib.h>


int score (float x, float y) { //Score function with 2 float arguments
	//The following code finds the values of r and assigns them with points based on what the input is.

	int r =sqrt(x*x+y*y);

	if (r<=3){
		return 100;
	}
	if (r<=6){
		return 80;
	}
	if (r<=9){
		return 60;
	}
	if (r<=12){
		return 40;
	}
	if (r<=15){
		return 20;
	}else{
		return 0;
	
	
	
	
	}}

I would expect an error to come from sqrt or that formula since I havnt finished it yet. I am trying to get the formula for a circle, and score will get the x and y coordinates and then after some math, determine w/e value it will return (as shown in the code).
Keep in mind that I used to have another cpp file in the same source file but I recently removed it and put it in its own project.
If anyone has any idea why this happens please let me know!!!

It's looking for a main() with the 2019 error. It needs some type of entry point to make the exe unless you are making a library (which I didn't read your other thread but it doesn't sound like that's what you're doing).

Ahh, that would do it. Thank you. I currently have my main() function commented out since I am working on that seperately. Its in the file, I merely didnt post it. Thanks again.
Would anyone happen to know the 1120 Error?

Are there any additional libraries from which you are trying to use code? I'm sure this has nothing to do with it, but you should change <stdlib.h> to <cstdlib> (akin to the cmath change).

the 1120 error comes from the 2019 error. if you get a LNK2019 error you will always get a LNK1102 error

Comments
Good insight, I had forgotten

So I think I got rid of the errors but now I need some help with the program. I am trying to have this read in x and y values, and then put them through the math to get r. Then I want r to run through the score function, and get that point value. Once it does it will tag the first set of coordinates to player1 and the 2nd to player2. Then determine the score of each player and decide the winner. Anyways I am stuck, and have been blanking on this for some time. If anyone could help, it would be appreciated.

#include <iostream>
using namespace std;
#include <cmath>
#include <cstdlib>




int score (float x, float y) { //Score function with 2 float arguments
	//The following code finds the values of r and assigns them with points based on what the input is.
	int r =sqrt(x*x+y*y);;

	if (r<=3){
		return 100;
	}
	if (r<=6){
		return 80;
	}
	if (r<=9){
		return 60;
	}
	if (r<=12){
		return 40;
	}
	if (r<=15){
		return 20;
	}else{
		return 0;
	
	
	return r;
	
	}}

int main () {
//Here I want it to read in the values do the math, then run it through 
//score and assign r to the point value, and then use that for player1
//player2 below.
	float x;
	float y;
	cin >> x >> y;
	int r =sqrt(x*x+y*y);
	//cout << r << "\n";
	
	

//Here I need something to have each player have their own score after the coordinates are read in and the score is calculated
	int player1 = ; 
	int player2= ;
	cout << "Player 1's score is " << player1 << "\n";
	cout << "Player 2's score is " << player2 << "\n";  //what goes here for the score of player 1 and 2.
	cout << "Final score is " << player1 << " to " << player2 << ".\n";
		if (player1 > player2){
			cout << "Player 1 wins!\n";
		}if (player2 > player1){
			cout << "Player 2 wins!\n";
		}if (player1 == player2){
			cout << "Tie Game\n";
		
		
		}}

This is what I have so far...I know that some of it is incomplete and would bring up errors but those are the parts I am blanking on. Thanks again.

I think what you ultimately want to do is have a while loop that governs a turn-based system.
I'm not precisely sure where your difficulties lie in the above steps. You should have a player1score and a player2score. In the turn based system I was proposing you would take in x and y for player1, run them through the score function, get the score back. Add that score to the existing player1score. Then repeat that for one run of player2, etc.

=( very interesting...lets see if I can figure this out.

This article has been dead for over six months. Start a new discussion instead.