What am I doing wrong

I'm trying to find the ratio of two squared values using a function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
using namespace std;
double square (int sp1, int sp2) {
return (sp1^2)/(sp2^2);
}

int main() {
int s1, s2;
cout << "Enter Speed #1: " ;
cin >>  s1;
cout<<"Enter Speed #2: " ;
cin >>  s2;
cout<<"Your squared ratio is " << square (s1, s2);
return 0;
 }

^ is the XOR operator. I suspect you're looking for the pow function.
Topic archived. No new replies allowed.