Do you guys have any idea where I've gone wrong?

/*
							Super Simple Calculator V3.0
									- Created By FTProtocol
*/

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

#define nl '\n'
#define PI 3.14159265
const double a=5;
const double b=3;
const double c=8;

	int x,y,choice;
	int ans=0;
	char loop;
	float div1;

int main()
{
		double resSqrt, resSin, resCos, resTan, resQuad[1];
		char boolSqrt='\0';

		printf(" Welcome to SCC - V3.0");
		Sleep(1500);
		printf("\n    - Created by FTProtocol");
		Sleep(5000);
		system("cls");
		printf(" Would you like to continue? (y/n): ");
		scanf("%s",&loop);

		if (loop =='y' || loop =='Y')
		{
			system("cls");
			printf("\n Please enter two numbers");
			printf("\n -----------------------");

			printf("\n\n Please enter the first number: ");
			scanf("%i",&x);

			printf("\n Please enter the second number: ");
			scanf("%i",&y);

			resSqrt = sqrt(x);
			resSin = sin(x*PI/180);
			resCos = cos(x*PI/180);
			resTan = tan(x*PI/180);
			resQuad[0] = (((-1)*b)+((b^2)-(4*a*c))^.5)/(2*a);
			resQuad[1] = (((-1)*b)-((b^2)-(4*a*c))^.5)/(2*a);

			system("cls");

			printf("\n Select an operation.");
			printf("\n\n 1. Addition");
			printf("\n 2. Subtraction");
			printf("\n 3. Multiplication");
			printf("\n 4. Division");
			printf("\n 5. Square Root");
			printf("\n 6. Sin");
			printf("\n 7. Cos");
			printf("\n 8. Tan");
			printf("\n 9. Quadratic Equation");

			printf("\n\n Please make your choice: ");
			scanf("%i",&choice);
		
			switch(choice)
			{
			case 1 :
				printf(" Answer: %i %c %c",(ans=x+y),nl,nl);
				break;
			case 2 :
				printf(" Answer: %i %c %c",(ans=x-y),nl,nl);
				break;
			case 3 :
				printf(" Answer: %i %c %c",(ans=x*y),nl,nl);
				break;
			case 4 :
				printf(" Answer: %i %c %c",(div1=x/y),nl,nl);
				break;
			case 5 :
				printf(" Answer: %f %c %c",(resSqrt),nl,nl);
				break;
			case 6 :
				printf(" Answer: %f %c %c",(resSin),nl,nl);
				break;
			case 7 :
				printf(" Answer: %f %c %c",(resCos),nl,nl);
				break;
			case 8 :
				printf(" Answer: %f %c %c",(resTan),nl,nl);
				break;
			case 9 :
				printf(" Answer: x=%f  and x=%f%t%c %c",(resQuad[0]),resQuad[1],nl,nl);
				break;
			default :
				printf("\n Illegal operation selected");
				break;
			}
				Sleep(1000);
				printf(" Thanks for using SSC - Program will now restart!%c%c",nl,nl);
				Sleep(3000);
				system("cls");
		}
		else{
				printf("\n Good-Bye :O %c%c",nl,nl);
				getchar();
		return 0;}

	main();
	return 0;
}

Error:

error C2296: '^' : illegal, left operand has type 'const double'

Lines:

resQuad[0] = (((-1)*b)+((b^2)-(4*a*c))^.5)/(2*a);
resQuad[1] = (((-1)*b)-((b^2)-(4*a*c))^.5)/(2*a);

It is the "Bitwise OR" operator.

Actually, it's the Bitwise XOR or exclusive-OR operator.
But you're right, the pow function should solve this compiler-error. Small example:

#include <iostream>
#include <math.h>

int main()
{
	std::cout << pow(3.0,2) <<  "\n";
	std::cin.get();
}

output: 9 (3^2)

commented: Yes, you are right. Good catch. +2

that would help me with basic exponents but with such a complex formula i dont think it will help....

I've tried many ways to use it but i really cant get it to work but please feel free to give me a little guidance on how to use it in conjunction with other parts of a formula.

it's easy, you have the formule, now convert it using pow(): (-1*b)+(pow(b,2)-pow(4*a*c,0.5))/(2*a); But I prefer to write it like this: (-1*b)+(pow(b,2)-sqrt(4*a*c))/(2*a); Just like the math-notation

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.