C++:
#include <iostream>
#include <windows.h>
#include <time.h>
using namespace std;
struct Person
{
string canGoOutside(int age, float temperature)
{
if(age >= 20 && age <= 45 && temperature >= -20 && temperature <= 30)
return "Можно идти гулять";
else if(age < 20 && temperature >= 0 && temperature <= 28)
return "Можно идти гулять";
else if(age > 45 && temperature >= -10 && temperature <= 25)
return "Можно идти гулять";
else
return "Отсавайтесь дома";
}
int generateRandomAge(int min, int max){
return min + rand() % (max + 1 - min);
}
};
int main()
{
SetConsoleCP(65001);
SetConsoleOutputCP(65001);
srand(time(NULL));
Person Adolf;
cout << Adolf.canGoOutside(15, 15) << endl;
cout << Adolf.canGoOutside(73,5) << endl;
cout << Adolf.canGoOutside(36, -10) << endl;
cout << Adolf.canGoOutside(19, -25) << endl;
cout << endl;
cout << Adolf.canGoOutside(Adolf.generateRandomAge(5, 65), -5) << endl;
cout << Adolf.canGoOutside(Adolf.generateRandomAge(5, 65), 10) << endl;
cout << Adolf.canGoOutside(Adolf.generateRandomAge(5, 65), 0) << endl;
cout << Adolf.canGoOutside(Adolf.generateRandomAge(5, 65), 40) << endl;
return 0;
}
Поделитесь своими знаниями, ответьте на вопрос:
1-10 Перевести числа из одной системы счисления в другую.В 11 347 10 ( )4;6 155 18 ( )2 ( )162 892 10 ( )7;7 51 10 ( )2 ( )8;3 331 15 ( )10;8 132 18 ( )2 ( )16;4 155 18 ( )10;9 8F7 16 ( )2 ( )8;5 1FC7 16 () 2;10 47 10 ( )2 ( )8.11.Расставить числа в порядке убывания: А=2С6116; В=110102; С=2268.12.Из заданной последовательности 1112, 348, 1012, А16, 768 удалитьсамое маленькое число.В файле В1 первая самостоятельная если что-то не понятно
QPython+SL4A:
import android
import time
import sys, select, os #for loop exit
#Initiate android-module
droid = android.Android()
#notify me
droid.makeToast("fetching GPS data")
print("start gps-sensor...")
droid.startLocating()
while True:
#exit loop hook
if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
line = input()
print("exit endless loop...")
break
#wait for location-event
event = droid.eventWaitFor('location',10000).result
if event['name'] == "location":
try:
#try to get gps location data
timestamp = repr(event['data']['gps']['time'])
longitude = repr(event['data']['gps']['longitude'])
latitude = repr(event['data']['gps']['latitude'])
altitude = repr(event['data']['gps']['altitude'])
speed = repr(event['data']['gps']['speed'])
accuracy = repr(event['data']['gps']['accuracy'])
loctype = "gps"
except KeyError:
#if no gps data, get the network location instead (inaccurate)
timestamp = repr(event['data']['network']['time'])
longitude = repr(event['data']['network']['longitude'])
latitude = repr(event['data']['network']['latitude'])
altitude = repr(event['data']['network']['altitude'])
speed = repr(event['data']['network']['speed'])
accuracy = repr(event['data']['network']['accuracy'])
loctype = "net"
data = loctype + ";" + timestamp + ";" + longitude + ";" + latitude + ";" + altitude + ";" + speed + ";" + accuracy
print(data) #logging
time.sleep(5) #wait for 5 seconds
print("stop gps-sensor...")
droid.stopLocating()