Answers for "convert c++ to python online"

0

convert c++ to python online

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<<"Tumpukan Sudah Penuh";
 getch();
}
else{
 T.Atas = T.Atas + 1;
 T.Isi[T.Atas] = x;
}
}
Posted by: Guest on June-17-2021
0

convert c++ to python online

int main() {
for(int i=1; i<20;i++) {
sum=A+1;
} ;
for(i=1; i>5; i++) {
if A!=sum {
B=B+A;
} ;
} ;
Posted by: Guest on October-07-2021
0

convert c++ to python online

void reverse_list (solution & pi)
{   vector<int >tour;
	int pointer;
	for (int i=0;i<=v_num-1;i++)
	{
		pointer=pi.sol[i][0];
		while (pointer!=0)
		{
			tour.push_back(pointer);
			pointer=pi.sol[i][pointer];
		}
		pi.sol_r[i][0]=tour.back();
		tour.pop_back();
		pointer=pi.sol_r[i][0];
		while (tour.size())
		{
			pi.sol_r[i][pointer]=tour.back();
			pointer=pi.sol_r[i][pointer];
			tour.pop_back();
		}
		pi.sol_r[i][pointer]=0;	}
}
Posted by: Guest on August-30-2021
0

convert c++ to python online

#include<iostream>
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 &c1, int &c2) {
    p1 = 1;
    p2 = 1;
    bool game = true;
    int jogadas = 0;

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

        if (p1 >= 36) {
            c1++;

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

        if (p2 >= 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 < TOTAL; i++){
        regrasDoJogo(player1, player2, count1, count2);

    }
    cout << "vitorias do p1:" << count1 << endl;
    cout << "vitorias do p2:" << count2 << endl;

    float porcentagem = (count1 / TOTAL)*100; 

    cout << "a probabilidade do primeiro ganhar é de:" << porcentagem <<"%"<< endl;

    system("pause");
    return 0;
}
Posted by: Guest on June-01-2021
0

convert c++ to python online

#include <iostream>

using namespace std;

int main()

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

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

num++;

}

num-;

for(int i=n;i>=1;i-)

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

}

return 0;

}
Posted by: Guest on July-05-2021
0

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();
            }
        }
    }

}
Posted by: Guest on June-16-2021
0

convert c++ to python online

#include <iostream> 
#include <string.h> 
int main (){
    int i;
    char telefone[20];
    char ch;
    i=0
    while((ch=getchar ())) 1='\n') (
        if (ch=='-')telefone[1]='-';
        else if (ch >=48 && ch <=57) telefone [i]=ch;
        else if (ch >=65 && ch <=67) telefone [i]='2';
        else if (ch >=68 && ch <=70) telefone [i]='3';
        else if (ch >=71 && ch <=73) telefone [i]='4';
        else if (ch >=74 && ch <=76) telefone [i]='5';
        else if (ch >=77 && ch <=79) telefone [i]='6';
        else if (ch >=80 && ch <=83) telefone [i]='7';
        else if (ch >=84 && ch <=86) telefone [i]='8';
        else if (ch >=87 && ch <=90) telefone [i]='9';
        
        i++;
    }
    telefone[i]='\0';
    printf("%s", telefone);
    return(0);
}
Posted by: Guest on September-04-2021
0

convert c++ to python online

#include <iostream>
using namespace std;
long long sort(arr,arr+n,greater<int>());

int main() {
    // your code goes here
    int T;
    cin>>T;
    for(int ts=0; ts<T; ts++)
    {
        long long int sum=0,n;
        cin>>n;
        long long int arr[n];
        for(long long int i=0; i<n; i++)
            cin>>arr[i];
        sort(arr[i],arr+n,greater<int>());
        for(long long int k=0; k<n; k++)
        {
            if(k==0)
            {
                sum=arr[k];
            }
            else if (arr[k]-k>=0)
            {
                sum=sum+arr[k]-k;
            }
            else {
                break;
            }
        }
        cout<<sum<<end1;
    }
    return 0;
}
Posted by: Guest on August-13-2021
0

convert c++ to python online

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void obradi(const vector<int>& particija, int k) {
  for (int i = 0; i < k; i++)
    cout << particija[i] << " ";
  cout << endl;
}
void obradiParticije(int n, int smax, vector<int>& particija, int k) {
  if (n <= 0)
    obradi(particija, k);
  else {
    for (int s = 1; s <= min(n, smax); s++) {
      particija[k] = s;
      obradiParticije(n-s, s, particija, k+1);
    }
}
void obradiParticije(int n) {
  vector<int> particija(n);
  obradiParticije(n, n, particija, 0);
}
int main() {
  int n;
  cin >> n;
  obradiParticije(n);
Posted by: Guest on May-20-2021

Code answers related to "convert c++ to python online"

Python Answers by Framework

Browse Popular Code Answers by Language