Help please

Hello, I am writing a program, it is supposed to find e^x for an x input. e^x can be found by: 1+ x^1/1! + x^2/2! + ... + x^n/n!

When I compile it the following message appears:

In function ΓÇÿint main()ΓÇÖ:
error: expected `;' before ΓÇÿ!ΓÇÖ token

I don't know much about c++, please help me with this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 #include <iostream>
using namespace std;
int main ()
{
    int x,n;
    double etox;
    etox=1 + x^n/(n)!;
    cout << "Insert the number";
    cin >> x;
    for (n=1;n<=100;n++){
        
        cout << etox;
    }

return 0;
}
^ is the bitwise XOR operator in C++. Use the std::pow function if you want exponentiation.
http://www.cplusplus.com/reference/cmath/pow/

! is the logical NOT operator. C++ doesn't have a factorial operator so you will have to write the code to calculate it yourself.
Topic archived. No new replies allowed.