Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void age_control() {
- int age;
- cout << "How old are you?";
- cin >> age;
- if (age >= 18) {
- cout << "admited" << endl;
- }
- else {
- cout << "denied" << endl;
- }
- }
- void is_even() {
- int k;
- cout << "Enter number "; cin >> k;
- if (k % 2) {
- cout << k << " is even.\n";
- }
- else {
- cout << k << " is odd.\n";
- }
- }
- void check_number() {
- int k;
- cout << "Enter number "; cin >> k;
- if (k == 0) {
- cout << k << " is zero.\n";
- }
- else if (k > 0) {
- cout << k << " is positive.\n";
- }
- else {
- cout << k << " is negative.\n";
- }
- }
- void is_ring() {
- double r1 = 1;
- double r2 = 2;
- double x = 1.5;
- double y = 1.2;
- double dist = pow(x, 2) + pow(y, 2);
- if ((dist > r1 * r1) && (dist <= r2 * r2)) {
- cout << "Bingo\n";
- }
- else {
- cout << "Milk\n";
- }
- }
- void is_teenager() {
- const int min_age = 14;
- const int max_age = 18;
- int age;
- cout << "Age? "; cin >> age;
- // && - and
- // || - or
- // ! - not
- // - xor
- if ((min_age <= age) && (age <= max_age)) {
- cout << "Yes" << endl;
- }
- else {
- cout << "No" << endl;
- }
- }
- int main() {
- setlocale(LC_ALL, "russian");
- //age_control();
- //is_even();
- //check_number();
- //is_ring();
- int x = (x == 0) ? -1 : 6;
- cout << ((x == 0) ?
- "zero " : ((x > 0) ?
- "positive " :
- "negative "));
- cout << endl;
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment