convert python code to c++ code example

Example 1: python to c++ transpiler

# Note: The last time I tested something was missing so I couldn't work
import pathlib
import transpyle

path = pathlib.Path('my_script.py')
code_reader = transpyle.CodeReader()
code = code_reader.read_file(path)

from_language = transpyle.Language.find('Python 3.6')
to_language = transpyle.Language.find('Fortran 95')
translator = transpyle.AutoTranslator(from_language, to_language)
fortran_code = translator.translate(code, path)
print(fortran_code)

Example 2: c++ code to python code converter online

#include <iostream>
using namespace std;

int main()
{
    char gender;
    double bodyweight, wrist, waist, hip, forearm, B, bodyfat, bfPercentage, A1, A2, A3, A4, A5;

    bodyfat = bodyweight - B;
    bfPercentage = (bodyfat * 100) / bodyweight;

    cout << "Input gender (m/f): ";
    cin >> gender;

    switch (gender)
    {
    case 'F':
    case 'f':
        cout << "Enter body weight: ";
        cin >> bodyweight;
        cout << "Enter wrist measurement (at fullest point): ";
        cin >> wrist;
        cout << "Enter waist measurement (at navel): ";
        cin >> waist;
        cout << "Enter hip measurement (at fullest point): ";
        cin >> hip;
        cout << "Enter forearm measurement (at fullest point): ";
        cin >> forearm;

        A1 = (bodyweight * 0.723) + 8.987;
        A2 = (wrist) / 3.140;
        A3 = (waist) * 0.157;
        A4 = (hip) * 0.249;
        A5 = (forearm) * 0.434;

        B = A1 + A2 - A3 - A4 + A5;

        cout << "Your body fat is: " << bodyfat << endl
             << "Body fat percentage: " << bfPercentage << "%";
             break;

    case 'M':
    case 'm':
        cout << "Enter body weight: ";
        cin >> bodyweight;
        cout << "Enter wrist measurement (at fullest point): ";
        cin >> wrist;

        A1 = (bodyweight * 1.082) + 94.42;
        A2 = wrist * 4.14;

        B = A1 - A2;

        cout << "Your body fat is: " << bodyfat << endl
             << "Body fat percentage: " << bfPercentage << "%";
             break;

    default:
        cout << "Invalid gender.";
    }

    return 0;
}