SavchukAndrew
05.07.2020 12:42

T=|x-y|/(1+|xy| )-x паскаль

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
koookBook
12.02.2021 08:39
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>

struct StudentData
{
    std::string name;
    std::string surname;
    int math;
    int phys;
    int comp_science;
};

bool
comp(const StudentData &a, const StudentData &b)
{
    int tmp1 = a.math + a.phys + a.comp_science;
    int tmp2 = b.math + b.phys + b.comp_science;
    return tmp1 > tmp2 ? true : false;
}

int
main(void)
{
    int n;
    std::cin >> n;
    std::vector< StudentData > data(n);
    for (int i = 0; i < n; i++) {
        std::cin >> data[i].name >> data[i].surname;
        std::cin >> data[i].math >> data[i].phys >> data[i].comp_science;
    }
    std::sort(data.begin(), data.end(), comp);
    for (int i = 0; i < n; i++) {
        std::cout << data[i].name << " " << data[i].surname << std::endl;
    }
    return 0;
}
0,0(0 оценок)
Ответ:
влад2262
25.02.2021 21:48

#include <iostream>

#include <cstring>

#include <string>

#include <sstream>

#include <ctime>

#include <cstdlib>

 

char MyAge(char*);

using namespace std;

 

int main()

{

   setlocale(LC_ALL,"rus");

 

   char str_result;

   char str1[20];

   cout << "Введите дату рождения в формате - число/месяц/год" << endl;

   cin >> str1;

 

    MyAge(str1);

 

   return 0;

}

 

char MyAge(char*str1)

{

 

   char day[3], month[3], year[5];

   int age;

   int a = 2021;

   //char str2[100];

   for(int i = 0; i < *str1; i++)

       if(str1[i] == '/')

           str1[i] = ' ';

   istringstream ss(str1);

 

   (ss >> day).get();

   (ss >> month).get();

   (ss >> year).get();

       age = atoi(year);

       age = a - age;

   ostringstream str2;

   str2 << "Лет - " << age << " Месяцев - "<< month << " Дней - " << day;

 

   cout << str2;

}

Объяснение:

from datetime import date

def calculate_age(born):

   today = date.today()

   try:  

       birthday = born.replace(year=today.year)

   except ValueError: # raised when birth date is February 29 and the current year is not a leap year

       birthday = born.replace(year=today.year, month=born.month+1, day=1)

   if birthday > today:

       return today.year - born.year - 1

   else:

       return today.year - born.year

Начало это си а конец питон

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота