№1 #include <iostream> using namespace std; int main () { int a,b; cin >> a >> b; if (a<b) cout << a << endl; else if (a==b) cout << "a=b" << endl; else cout << b << endl; system ("PAUSE"); return 0; }
№2 #include <iostream> using namespace std; int main () { char ch1,ch2; int i1,i2; cin >> ch1 >> ch2; i1=ch1; i2=ch2; if (i1<=i2) cout << ch1 << ' ' << ch2 << endl; else cout << ch2 << ' ' << ch1 << endl; system ("PAUSE"); return 0; }
№3 #include <iostream> using namespace std; int main () { float p,q; cout << "p="; cin >> p; cout << "q="; cin >> q; cout << p-2*q << endl; system ("PAUSE"); return 0; }
Первая
x = raw_input("Введите х")
y = raw_input("Введите y")
print [x,y][x>y]
вторая
a = raw_input("Введите первый символ")
b = raw_input("Введите второй символ")
c = [a,b]
c.sort()
print c
третья
p = raw_input("Введите p")
q = raw_input("Введите q")
print "масса бидона ", 2*int(q)-int(p)
#include <iostream>
using namespace std;
int main ()
{
int a,b;
cin >> a >> b;
if (a<b) cout << a << endl;
else if (a==b) cout << "a=b" << endl;
else cout << b << endl;
system ("PAUSE");
return 0;
}
№2
#include <iostream>
using namespace std;
int main ()
{
char ch1,ch2;
int i1,i2;
cin >> ch1 >> ch2;
i1=ch1;
i2=ch2;
if (i1<=i2) cout << ch1 << ' ' << ch2 << endl;
else cout << ch2 << ' ' << ch1 << endl;
system ("PAUSE");
return 0;
}
№3
#include <iostream>
using namespace std;
int main ()
{
float p,q;
cout << "p=";
cin >> p;
cout << "q=";
cin >> q;
cout << p-2*q << endl;
system ("PAUSE");
return 0;
}