import tkinter as tk
class Form(tk.Frame):
def __init__(self, root):
super().__init__(root)
self.master = root
self.master.title('Window #1')
self.master.resizable(False, False)
self.master.geometry('500x600')
self.build()
def build(self):
frame = tk.Frame(self, width = 500, height = 600, bg = 'green')
frame.pack()
def main():
root = tk.Tk()
form = Form(root)
form.pack()
root.mainloop()
if __name__ == '__main__':
main()
Объяснение:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
srand(time(0));
for(int i=0; i<n; i++)
a[i]=-99+rand()%199;
cout << setw(4) <<a[i];
}
cout << endl;
int j=n-1;
while(j>0)
int mx=a[0], imx=0;
for(int i=1; i<=j; i++)
if(a[i]>mx)
mx=a[i];
imx=i;
a[imx]=a[j];
a[j]=mx;
j--;
return 0;
import tkinter as tk
class Form(tk.Frame):
def __init__(self, root):
super().__init__(root)
self.master = root
self.master.title('Window #1')
self.master.resizable(False, False)
self.master.geometry('500x600')
self.build()
def build(self):
frame = tk.Frame(self, width = 500, height = 600, bg = 'green')
frame.pack()
def main():
root = tk.Tk()
form = Form(root)
form.pack()
root.mainloop()
if __name__ == '__main__':
main()
Объяснение:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
srand(time(0));
for(int i=0; i<n; i++)
{
a[i]=-99+rand()%199;
cout << setw(4) <<a[i];
}
cout << endl;
int j=n-1;
while(j>0)
{
int mx=a[0], imx=0;
for(int i=1; i<=j; i++)
if(a[i]>mx)
{
mx=a[i];
imx=i;
}
a[imx]=a[j];
a[j]=mx;
j--;
}
for(int i=0; i<n; i++)
cout << setw(4) <<a[i];
return 0;
}