Certainly, here's the above Python code rewritten in JavaScript and C++:

**JavaScript:**
```javascript
const filename = 'test.png';
const maxResolution = '512x512';

// Extract the filename without the file extension
const filenameWithoutExtension = filename.split('.')[0];

// Create the newFilename by combining filenameWithoutExtension, maxResolution, and '.jpg'
const newFilename = `${filenameWithoutExtension}+${maxResolution}.jpg`;

// Print the newFilename
console.log(newFilename);
```

**C++:**
```cpp
#include <iostream>
#include <string>

int main() {
    std::string filename = "test.png";
    std::string maxResolution = "512x512";

    // Extract the filename without the file extension
    size_t dotPosition = filename.find_last_of('.');
    std::string filenameWithoutExtension = filename.substr(0, dotPosition);

    // Create the newFilename by combining filenameWithoutExtension, maxResolution, and ".jpg"
    std::string newFilename = filenameWithoutExtension + "+" + maxResolution + ".jpg";

    // Print the newFilename
    std::cout << newFilename << std::endl;

    return 0;
}
```

These code snippets perform the same operations as the original Python code to extract the filename without the extension and create a new filename by combining it with the maximum resolution and the file extension. They also print the new filename to the console.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence