c++ to python code converter

#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;
}

0
0
Df86 90 points

                                    #include&lt;bits/stdc++.h&gt;
#include &lt;iostream&gt;

using namespace std;


struct n{
    int d;
    struct n*next;
    };

void push(struct n**headref, int new_d)
{
    struct n* new_node=new n;
    new_node-&gt;d=new_d;
    new_node-&gt;next=(*headref);
    (*headref)=new_node;
    }
    
    float avgofnodes(struct n*head)
    {
        if(!head){return -1;}
        int c=0;
        int s=0;
        float avg =0.0;
        struct n*now=head;
        while(now!=NULL)
        {
            c++;
            s+=now-&gt;d;
            now=now-&gt;next;
            }
        avg=(double)s/c;
        return avg;
        }

int main()
{
struct n*head=NULL;
push(&amp;head , 7);
push(&amp;head, 6);
push(&amp;head, 8);
push(&amp;head, 4);
push(&amp;head, 1);
	cout&lt;&lt;&quot;Average of nodes = &quot;&lt;&lt;avgofnodes(head);
return 0;	
}

0
0
4
1
Atiyar 125 points

                                    int main{
int i, n;
cin&gt;&gt;n;
for(i=0; i&lt;n; i++)
    cin&gt;&gt;a[i];
 

4 (1 Votes)
0
4.5
2
Jeloh Simo 80 points

                                    int main{
int i, n;
cin&gt;&gt;n;
for(i=0; i&lt;n; i++)
    cin&gt;&gt;a[i];

4.5 (2 Votes)
0
3.63
8
Yuuko 110 points

                                    #include &lt;iostream&gt;

using namespace std;

int main()

{ int n=4,num-n-1; for(int i=1;i&lt;n;i++) {

for(int j=1;j&lt;=i;j++) cout&lt;&lt;num; cout&lt;&lt;endl;

num++;

}

num-;

for(int i=n;i&gt;=1;i-)

{ for(int j=1;j&lt;=i;j++) cout&lt;&lt;num; num--; cout&lt;&lt;endl;

}

return 0;

3.63 (8 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source