ответ:
// consoleapplication2.cpp : this file contains the 'main' function. program execution begins and ends there.
//
#include
#include
#include
using std: : vector;
using std: : cout;
using std: : random_device;
using std: : mt19937;
using std: : uniform_int_distribution;
using std: : endl;
int main()
{
// объявляем костанты и переменные
const int number_of_barrels = 90;
const int number_of_random_numbers_to_generate = 5;
const int range_from = 0;
const int range_to = number_of_barrels;
random_device rand_dev;
mt19937 generator(;
vector barrels;
cout < < "filling vector." < < endl;
for(int i = 0; i < number_of_barrels; i++) {
barrels.push_back(i+1);
}
cout < < "getting 5 random numbers from the vector and showing it on the screen: " < < endl;
for(int i = 0; i < number_of_random_numbers_to_generate; i++) {
uniform_int_distribution distr(range_from, range_to - i);
int randomnumber = distr(generator); // генерируем рандомное число
int numberat = barrels.at(randomnumber); // читаем число из вектора и иницализируем переменную numberat этим числом
barrels.erase(std: : cbegin(barrels) + randomnumber); // удаляем это число из вектора
cout < < numberat < < " "; // выводим это число на экран.
}
}
// run program: ctrl + f5 or debug > start without debugging menu
// debug program: f5 or debug > start debugging menu
// tips for getting started:
// 1. use the solution explorer window to add/manage files
// 2. use the team explorer window to connect to source control
// 3. use the output window to see build output and other messages
// 4. use the error list window to view errors
// 5. go to project > add new item to create new code files, or project > add existing item to add existing code files to the project
// 6. in the future, to open this project again, go to file > open > project and select the .sln file
объяснение:
в комментариях.
june = float(input('сколько денег арсений получал в июне? '))
jule = float(input('сколько денег арсений получал в июле? '))
aug = float(input('сколько денег арсений получал в августе? '))
sum = 0
for i in range(3):
if (june % 2 == 0) and (june > 499):
sum = sum + june
elif (jule % 2 == 0) and (jule > 499):
sum = sum + jule
elif (aug % 2 == 0) and (aug > 499):
sum += aug
print(sum)
Поделитесь своими знаниями, ответьте на вопрос: