Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Multiplying floating point numbers

Go to solution Solved by WereCatf,
2 minutes ago, Forenman said:

i don't understand why my code aint working

You don't have main(), which is required.

I am programming in c and it keeps throwing exceptions. Trying to read in 4 floating point numbers then multiply them in the formula "result = ax^2+bx+c", i don't understand why my code aint working..... i keep getting the exception
Error    LNK2019    unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)    Formula    C:\Users\james\OneDrive\Documents\Year 4\Object Programing\Formula\Formula\MSVCRTD.lib(exe_main.obj)    1    

 

#include <stdio.h>
int function()
{
	double x, a, b, c, result;
	printf("Enter value for X:");
	scanf_s("%lf", &x);
	printf("Enter value for A:");
	scanf_s("%lf", &a);
	printf("Enter value for B:");
	scanf_s("%lf", &b);
	printf("Enter value for C:");
	scanf_s("%lf", &c);

	result = (a * pow(x,2)) + b * x + c;

	printf("result is = %lf", result);
	return(result);
}

 

Link to post
Share on other sites
2 minutes ago, Forenman said:

i don't understand why my code aint working

You don't have main(), which is required.

Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×