Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Билет №3
- //int main()
- //{
- // int fir, sec;
- // cout << "Enter your numbers." << endl;
- // cin >> fir;
- // cin >> sec;
- // if (fir > sec) {
- // cout << "The largest number is " << fir << endl;
- // }
- // else {
- // cout << "The largest number is " << sec << endl;
- // }
- // system("pause");
- // return 0;
- //}
- //int main()
- //{
- // srand(time(0));
- // int prod, max = 0, k = 13;
- // int *arr = new int[k];
- // for (int i = 0; i < k; i++)
- // arr[i] = 13 + rand() % 987 + 1;
- // cout << "The array: ";
- // for (int i = 0; i < 12; i++)
- // cout << arr[i] << ' ';
- // cout << endl;
- // for (int i = 0; i < k; i++) {
- // prod = arr[i] * arr[i + 1];
- // if (prod > max)
- // max = prod;
- // }
- // cout << "Max product is " << max << endl;
- // delete[] arr;
- // system("pause");
- // return 0;
- //}
- //int main()
- //{
- // srand(time(0));
- // int k = 3;
- // int *arr = new int[k];
- // arr[0] = rand() % 100;
- // arr[1] = arr[0];
- // arr[2] = arr[0];
- // cout << "The array: ";
- // for (int i = 0; i < k; i++)
- // cout << arr[i] << ' ';
- // cout << endl;
- // delete[] arr;
- // system("pause");
- // return 0;
- //}
- // Экзамен. билеты.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <vector>
- #include <ctime>
- #include <cstdlib>
- #include <fstream>
- using namespace std;
- //Билет №9
- //Дано четырехзначное число. Поменяйте местами наименьшую и наибольшую цифры.
- //int main()
- //{
- // int min = 9, max = 0, num, k = 4, a = 1000, n, x;
- // cout << "Enter your number:" << endl;
- // cin >> num;
- // if (num < 1000 || num > 9999) {
- // cout << "Try again:" << endl;
- // cin >> num;
- // }
- // int *arr = new int[k];
- // for (int i = 0; i < k; i++) {
- // arr[i] = num / a;
- // num = num % a;
- // a = a / 10;
- // }
- // for (int i = 0; i < k; i++) {
- // if (arr[i] > max)
- // max = arr[i];
- // if (arr[i] < min)
- // min = arr[i];
- // }
- // for (int i = 0; i < k; i++) {
- // if (arr[i] == max)
- // n = i;
- // if (arr[i] == min)
- // x = i;
- // }
- // arr[n] = min;
- // arr[x] = max;
- // cout << "The new number:" << endl;
- // for (int i = 0; i < k; i++)
- // cout << arr[i];
- // cout << endl;
- // delete[] arr;
- // system("pause");
- // return 0;
- //}
- //// Дано число k. Определите, существует ли такое число n, что 1+2+3+..+n=k.
- //int main()
- //{
- // int k, n, m = 0, a = 1;
- // cout << "Enter your number:" << endl;
- // cin >> k;
- // while (m < k) {
- // m = m + a;
- // a += 1;
- // }
- // if (m == k)
- // cout << "The number n is " << a - 1 << endl;
- // else
- // cout << "The number n doesn't exist" << endl;
- // system("pause");
- // return 0;
- //}
- // Найдите сумму четных чисел массива.
- //int main()
- //{
- // srand(time(0));
- // int sum = 0, k;
- // cout << "Enter the size of the array: ";
- // cin >> k;
- // int *arr = new int[k];
- // for (int i = 0; i < k; i++)
- // arr[i] = rand() % 100 + 1;
- // cout << "The array: ";
- // for (int i = 0; i < k; i++)
- // cout << arr[i] << ' ';
- // cout << endl;
- // for (int i = 0; i < k; i++) {
- // if (arr[i] % 2 == 0)
- // sum = sum + arr[i];
- // }
- // cout << "Sum of odd numbers: " << sum << endl;
- // delete[] arr;
- // system("pause");
- // return 0;
- //}
- //Билет №5
- //// Написать рекурсивную функцию для расчета степени n вещественного числа a (n - натуральное число).
- //int pow(int a, int n) {
- // if (n == 1) return a;
- // int prpow = pow(a, n - 1);
- // return a * prpow;
- //}
- //
- //int main()
- //{
- // int b, k, c = -0;
- // cout << "Enter the number: ";
- // cin >> b;
- // cout << "Enter the power: ";
- // cin >> k;
- // while (k > 0) {
- // k -= 1;
- // c += 1;
- // cout << pow(b, c) << " ";
- // }
- // cout << endl;
- // system("pause");
- // return 0;
- //}
- //// Составить список учебной группы. Вывод ФИО всех студентов, у которых все оценки отлично.
- //#include "stdafx.h"
- //#include <iostream>
- //#include <string>
- //using namespace std;
- //struct date
- //{
- // int day, month, year;
- //};
- //struct rec_book
- //{
- // int mark; //оценка
- // string lesson;
- // string teacher;
- // date ekz_day;
- //};
- //struct student
- //{
- // string name;
- // date b_day;
- // rec_book book[3];
- //};
- //
- //
- //
- //int main()
- //{
- // student studs[5];
- // studs[0].name = "John Warner";
- // studs[0].b_day.day = 23;
- // studs[0].b_day.month = 12;
- // studs[0].b_day.year = 1999;
- // studs[0].book[0].mark = 2;
- // studs[0].book[0].lesson = "Physics: ";
- // studs[0].book[0].teacher = "Sterlyadkin V.V.";
- // studs[0].book[0].ekz_day.day = 27;
- // studs[0].book[0].ekz_day.month = 6;
- // studs[0].book[0].ekz_day.year = 2018;
- // studs[0].book[1].mark = 4;
- // studs[0].book[1].lesson = "Algebra and geometry:";
- // studs[0].book[1].teacher = "Svyatova E.A. ";
- // studs[0].book[1].ekz_day.day = 18;
- // studs[0].book[1].ekz_day.month = 6;
- // studs[0].book[1].ekz_day.year = 2018;
- // studs[0].book[2].mark = 4;
- // studs[0].book[2].lesson = "Programming: ";
- // studs[0].book[2].teacher = "Sachkov V.E. ";
- // studs[0].book[2].ekz_day.day = 23;
- // studs[0].book[2].ekz_day.month = 6;
- // studs[0].book[2].ekz_day.year = 2018;
- //
- // studs[1].name = "Nickolas Shelton";
- // studs[1].b_day.day = 3;
- // studs[1].b_day.month = 8;
- // studs[1].b_day.year = 1998;
- // studs[1].book[0].mark = 4;
- // studs[1].book[0].lesson = "Physics: ";
- // studs[1].book[0].teacher = "Sterlyadkin V.V.";
- // studs[1].book[0].ekz_day.day = 27;
- // studs[1].book[0].ekz_day.month = 6;
- // studs[1].book[0].ekz_day.year = 2018;
- // studs[1].book[1].mark = 3;
- // studs[1].book[1].lesson = "Algebra and geometry:";
- // studs[1].book[1].teacher = "Svyatova E.A. ";
- // studs[1].book[1].ekz_day.day = 18;
- // studs[1].book[1].ekz_day.month = 6;
- // studs[1].book[1].ekz_day.year = 2018;
- // studs[1].book[2].mark = 5;
- // studs[1].book[2].lesson = "Programming: ";
- // studs[1].book[2].teacher = "Sachkov V.E. ";
- // studs[1].book[2].ekz_day.day = 23;
- // studs[1].book[2].ekz_day.month = 6;
- // studs[1].book[2].ekz_day.year = 2018;
- //
- // studs[2].name = "Kathryn Campbell";
- // studs[2].b_day.day = 1;
- // studs[2].b_day.month = 1;
- // studs[2].b_day.year = 2000;
- // studs[2].book[0].mark = 5;
- // studs[2].book[0].lesson = "Physics: ";
- // studs[2].book[0].teacher = "Sterlyadkin V.V.";
- // studs[2].book[0].ekz_day.day = 27;
- // studs[2].book[0].ekz_day.month = 7;
- // studs[2].book[0].ekz_day.year = 2018;
- // studs[2].book[1].mark = 4;
- // studs[2].book[1].lesson = "Algebra and geometry:";
- // studs[2].book[1].teacher = "Svyatova E.A. ";
- // studs[2].book[1].ekz_day.day = 18;
- // studs[2].book[1].ekz_day.month = 6;
- // studs[2].book[1].ekz_day.year = 2018;
- // studs[2].book[2].mark = 5;
- // studs[2].book[2].lesson = "Programming: ";
- // studs[2].book[2].teacher = "Sachkov V.E. ";
- // studs[2].book[2].ekz_day.day = 23;
- // studs[2].book[2].ekz_day.month = 6;
- // studs[2].book[2].ekz_day.year = 2018;
- //
- // studs[3].name = "Walter Mills";
- // studs[3].b_day.day = 23;
- // studs[3].b_day.month = 2;
- // studs[3].b_day.year = 2000;
- // studs[3].book[0].mark = 5;
- // studs[3].book[0].lesson = "Physics: ";
- // studs[3].book[0].teacher = "Sterlyadkin V.V.";
- // studs[3].book[0].ekz_day.day = 27;
- // studs[3].book[0].ekz_day.month = 6;
- // studs[3].book[0].ekz_day.year = 2018;
- // studs[3].book[1].mark = 4;
- // studs[3].book[1].lesson = "Algebra and geometry:";
- // studs[3].book[1].teacher = "Svyatova E.A. ";
- // studs[3].book[1].ekz_day.day = 18;
- // studs[3].book[1].ekz_day.month = 6;
- // studs[3].book[1].ekz_day.year = 2018;
- // studs[3].book[2].mark = 4;
- // studs[3].book[2].lesson = "Programming: ";
- // studs[3].book[2].teacher = "Sachkov V.E. ";
- // studs[3].book[2].ekz_day.day = 23;
- // studs[3].book[2].ekz_day.month = 6;
- // studs[3].book[2].ekz_day.year = 2018;
- //
- // studs[4].name = "Steven Campbell";
- // studs[4].b_day.day = 15;
- // studs[4].b_day.month = 8;
- // studs[4].b_day.year = 2000;
- // studs[4].book[0].mark = 5;
- // studs[4].book[0].lesson = "Physics: ";
- // studs[4].book[0].teacher = "Sterlyadkin V.V.";
- // studs[4].book[0].ekz_day.day = 27;
- // studs[4].book[0].ekz_day.month = 7;
- // studs[4].book[0].ekz_day.year = 2018;
- // studs[4].book[1].mark = 5;
- // studs[4].book[1].lesson = "Algebra and geometry:";
- // studs[4].book[1].teacher = "Svyatova E.A. ";
- // studs[4].book[1].ekz_day.day = 18;
- // studs[4].book[1].ekz_day.month = 6;
- // studs[4].book[1].ekz_day.year = 2018;
- // studs[4].book[2].mark = 5;
- // studs[4].book[2].lesson = "Programming: ";
- // studs[4].book[2].teacher = "Sachkov V.E. ";
- // studs[4].book[2].ekz_day.day = 23;
- // studs[4].book[2].ekz_day.month = 6;
- // studs[4].book[2].ekz_day.year = 2018;
- //
- // for (int i = 0; i < 5; i++)
- // {
- // cout << "The student #" << i+1 << ": \n";
- // cout << studs[i].name << ", birthday: " << studs[i].b_day.day << "." << studs[i].b_day.month << "." << studs[i].b_day.year << endl;
- // cout << "Progress of this student: \n";
- // for (int k = 0; k < 3; k++)
- // {
- // cout << studs[i].book[k].lesson << " mark " << studs[i].book[k].mark << ", teacher " << studs[i].book[k].teacher << " exam date " << studs[i].book[k].ekz_day.day << "." << studs[i].book[k].ekz_day.month << "." << studs[i].book[k].ekz_day.year << endl;
- // }
- // cout << endl;
- // }
- // cout << endl;
- // cout << "Honors students:" << endl;
- // for (int i = 0; i < 5; i++)
- // {
- // if ((studs[i].book[0].mark >= 5) && (studs[i].book[1].mark >= 5) && (studs[i].book[2].mark >= 5))
- // {
- // cout << studs[i].name << endl;
- // }
- // };
- // cout << endl;
- // system("pause");
- // return 0;
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement