convert c++ to python online

#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <time.h>


using namespace std;


int main()
{
    cout << "===============================================================================" << endl;
    cout << "External Rapid Fire by EPiC REV (Copyright 2013 @ EPiC REV). Works in any game!" << endl;
    cout << "===============================================================================" << endl;
    cout << "Press right-click in game to rapid fire." << endl;


    bool RapidFire = false;
    int AutoFireTimer = clock();
    int currentTime;
    bool MouseDown = false;
    while(true)
    {
        //Check for right mouse button to be down.
        if(GetAsyncKeyState(VK_RBUTTON) & 0x8000)RapidFire = true;
        else RapidFire = false;


        if(RapidFire)
        {
            //only go if so many milliseconds have passed.
            if(!MouseDown)
            {
                MouseDown = true;
                mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //
            }
            if(clock() - AutoFireTimer > 21)
            {
                MouseDown = false;
                mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); //
                AutoFireTimer = clock();
            }
        }
    }

}

4.8
5
Kate 85 points

                                    #include&lt;iostream&gt;
using namespace std;

int dado() {

    return rand() % 6 + 1;
}

void casasEspeciais( int player){
    switch (player) {
    case 3:
        player = 16;
        break;
    case 5:
        player = 7;
        break;
    case 15:
        player = 25;
        break;
    case 18:
        player = 20;
        break;
    case 21:
        player = 32;
        break;
    case 12:
        player = 2;
        break;
    case 14:
        player = 11;
        break;
    case 17:
        player = 4;
        break;
    case 31:
        player = 19;
        break;
    case 35 :
        player = 22;
        break;
    default:
        break;
    }
}

void regrasDoJogo(int p1,int p2, int &amp;c1, int &amp;c2) {
    p1 = 1;
    p2 = 1;
    bool game = true;
    int jogadas = 0;

    while (game)
    {
        p1 += dado();
        casasEspeciais(p1);

        if (p1 &gt;= 36) {
            c1++;

            game = false;
            break;
        }
        p2 += dado();
        casasEspeciais(p2);

        if (p2 &gt;= 36){
            c2++;

            game = false;
            break;
        }
        jogadas++;
    };

}

int player1, player2;
int count1, count2;

float TOTAL = 10000.0f;

int main() {
    count1 = 0;
    count2 = 0;

    srand(time(NULL));

    for (int i = 0; i &lt; TOTAL; i++){
        regrasDoJogo(player1, player2, count1, count2);

    }
    cout &lt;&lt; &quot;vitorias do p1:&quot; &lt;&lt; count1 &lt;&lt; endl;
    cout &lt;&lt; &quot;vitorias do p2:&quot; &lt;&lt; count2 &lt;&lt; endl;

    float porcentagem = (count1 / TOTAL)*100; 

    cout &lt;&lt; &quot;a probabilidade do primeiro ganhar &eacute; de:&quot; &lt;&lt; porcentagem &lt;&lt;&quot;%&quot;&lt;&lt; endl;

    system(&quot;pause&quot;);
    return 0;
}

4.8 (5 Votes)
0
3
1

                                    convert c++ to python online

3 (1 Votes)
0
4
5
Brook 85 points

                                    struct Tumpukan
{
 char Isi[MaxElemen];
   int Atas;
} T;

//sub program PUSH berfungsi memasukkan elemen ke dalam STACK
void PUSH (char x){ //fungsi push
if(T.Atas == MaxElemen){  //untuk mengecek apakah stack sudah penuh
 cout&lt;&lt;&quot;Tumpukan Sudah Penuh&quot;;
 getch();
}
else{
 T.Atas = T.Atas + 1;
 T.Isi[T.Atas] = x;
}
}

4 (5 Votes)
0
3.75
4
Tsawlrite 85 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.75 (4 Votes)
0
3.7
10

                                    #include &lt;iostream&gt;
using namespace std;
long long sort(arr,arr+n,greater&lt;int&gt;());

int main() {
    // your code goes here
    int T;
    cin&gt;&gt;T;
    for(int ts=0; ts&lt;T; ts++)
    {
        long long int sum=0,n;
        cin&gt;&gt;n;
        long long int arr[n];
        for(long long int i=0; i&lt;n; i++)
            cin&gt;&gt;arr[i];
        sort(arr[i],arr+n,greater&lt;int&gt;());
        for(long long int k=0; k&lt;n; k++)
        {
            if(k==0)
            {
                sum=arr[k];
            }
            else if (arr[k]-k&gt;=0)
            {
                sum=sum+arr[k]-k;
            }
            else {
                break;
            }
        }
        cout&lt;&lt;sum&lt;&lt;end1;
    }
    return 0;
}

3.7 (10 Votes)
0
3.67
3
Adam Snoza 110 points

                                    struct Tumpukan
{
 char Isi[MaxElemen];
   int Atas;
} T;

//sub program PUSH berfungsi memasukkan elemen ke dalam STACK
void PUSH (char x){ //fungsi push
if(T.Atas == MaxElemen){  //untuk mengecek apakah stack sudah penuh
 cout&lt;&lt;&quot;Tumpukan Sudah Penuh&quot;;
 getch();
}
else{
 T.Atas = T.Atas + 1;
 T.Isi[T.Atas] = x;
}
}

3.67 (3 Votes)
0
4.17
6

                                    #include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;
using namespace std;
void obradi(const vector&lt;int&gt;&amp; particija, int k) {
  for (int i = 0; i &lt; k; i++)
    cout &lt;&lt; particija[i] &lt;&lt; &quot; &quot;;
  cout &lt;&lt; endl;
}
void obradiParticije(int n, int smax, vector&lt;int&gt;&amp; particija, int k) {
  if (n &lt;= 0)
    obradi(particija, k);
  else {
    for (int s = 1; s &lt;= min(n, smax); s++) {
      particija[k] = s;
      obradiParticije(n-s, s, particija, k+1);
    }
}
void obradiParticije(int n) {
  vector&lt;int&gt; particija(n);
  obradiParticije(n, n, particija, 0);
}
int main() {
  int n;
  cin &gt;&gt; n;
  obradiParticije(n);

4.17 (6 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