Question: I'm currently working a summer course in programming to learn more while school is on summer break. In one of the assignements, I need to use the given variables to calculate the power of two values. I dont know the values beforehand, as the website generates different values when I try to run the program. I've hit my head against the wall for the whole day so any help nudging me in the right direction is appreciated!! Example of the assignment below.

```
**function laskuFunktio() {
    var luku = noudaArvo("luku");
    var eksp = noudaArvo("eksponentti");

    console.log("Luku " + luku + " potenssiin " + eksp + " on:");
    console.log(laskePotenssi(luku, eksp));
}**

function noudaArvo() { 
    luku = document.getElementById("luku").value        
    eksp = document.getElementById("eksponentti").value;
    return ???
}

function laskePotenssi() {
    if (eksp === 0) {
        tulos = 1;
    }
    var tulos = Math.pow(luku, eksp);
    return tulos 
}

```

The first function is predetermined so I cant edit it, but the assignments are made possible without editing it or accessing the HTML files. The return statement was just edited by me to sho where I currently am stuck. Thanks for any help once more!

Answer: 
My guess: your current working directory isn't what you think it is, especially if you're running from an IDE. I know of several IDEs where the current working directory is some build directory (it varies by IDE) unless you specifically change it.

I'm fairly sure Visual Studio is one such IDE.

---

Here's a tiny example program I wrote;

```
$ cat Foo.cpp
#include <iostream>
#include <fstream>

int main(int, char **) {
    std::ifstream file { "Foo.cpp" };

    if (file) {
        std::cout << "File opened.\n";
    }
    else {
        std::cout << "File not opened.\n";
    }
}

```

Compile and run it:

```
$ g++ --std=c++17 Foo.cpp -o Foo && Foo
File opened.

```
The `std::filesystem` library can help you resolve file and path related issues.

```
#include <filesystem>

    // (in some function)
    std::filesystem::path filepath = "alarmes.txt";
    if ( !exists(filepath) )
    {
        std::cout << "File path " << filepath << " at absolute location "
                  << absolute(filepath) << " does not exist\n";
    }

```

[See it on Compiler Explorer](https://godbolt.org/z/aP6zaj4Y6)