Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------
- 1
- #include <iostream>
- #include <clocale>
- #include <windows.h>
- using namespace std;
- static void SetCursorPosition(int x, int y)
- {
- COORD coord;
- coord.X = x;
- coord.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
- }
- void main()
- {
- setlocale(LC_ALL, "Russian");
- system("mode con cols=80 lines=40");
- int count = 0, mark, sum;
- for (int i = 0; i < 77; i++) cout << '-';
- cout << "\nСтуденты: |";
- for (int i = 1; i <= 15; i++) cout << " " << i << " |";
- cout << endl;
- for (int i = 0; i < 77; i++) cout << '-';
- for (int i = 1; i <= 4; i++)
- {
- if(i < 4) cout << endl << i << " предмет |";
- else cout << endl << "Ср. балл |";
- for (int i = 1; i <= 15; i++)
- {
- if(i < 10) cout << " |";
- else cout << " |";
- }
- }
- cout << endl;
- for (int i = 0; i < 77; i++) cout << '-';
- for (int i = 1; i <= 15; i++)
- {
- sum = 0;
- bool whitoutBadMarks = true;
- for (int j = 1; j <= 3; j++)
- {
- do
- {
- SetCursorPosition(0, 9); cout << " \n \n ";
- SetCursorPosition(0, 8);
- cout << "Введите оценку " << i << "-го студента по " << j << "-му предмету. " << endl;
- cin >> mark;
- SetCursorPosition(0, 8);
- } while (!(mark > 0 && mark < 6));
- if (i < 10) SetCursorPosition(12 + (4 * (i - 1)), j + 2);
- else SetCursorPosition(48 + (5 * (i - 10)), j + 2);
- cout << mark;
- if (mark <= 2) whitoutBadMarks = false;
- sum += mark;
- }
- if (whitoutBadMarks) count++;
- if (i < 10) SetCursorPosition(12 + (4 * (i - 1)), 6);
- else SetCursorPosition(48 + (5 * (i - 10)), 6);
- cout << sum / 3 << endl;
- }
- SetCursorPosition(0, 10);
- cout << "Количество студентов без двоек: " << count << endl;
- cout << "Нажмите ESC для выхода.";
- while (true) if (GetAsyncKeyState(VK_ESCAPE)) break;
- }
- ---------------------------
- 2
- /*Початковий внесок в банку рівний 1000 грн.Через кожен місяць розмір внеску
- збільшується на P відсотків від наявної суми(P дійсне число, 0 < P < 25).По даному P
- визначити, через скільки місяців розмір внеску перевищить 1100 грн., і вивести знайдену
- кількість місяців K(ціле число) і підсумковий розмір внеску S(дійсне число).*/
- #include <iostream>
- #include <clocale>
- using namespace std;
- void main()
- {
- setlocale(LC_ALL, "Russian");
- int mounce = 0;
- double persent, money = 1000;
- do
- {
- cout << "Введите процент(0 < P < 25): ";
- cin >> persent;
- system("cls");
- }
- while (!(persent > 0 && persent < 25));
- while (money < 1100)
- {
- mounce++;
- money *= 1 + persent / 100;
- }
- cout <<"Количество месяцев: " << mounce << endl;
- cout << "Итоговая сумма: " << money << endl;
- system("pause");
- }
- -------------------------------
- 3
- #include <iostream>
- #include <clocale>
- #include <windows.h>
- using namespace std;
- static void SetCursorPosition(int x, int y)
- {
- COORD coord;
- coord.X = x;
- coord.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
- }
- void main()
- {
- setlocale(LC_ALL, "Russian");
- system("mode con cols=80 lines=40");
- int heigth;
- do
- {
- system("cls");
- cout << "Введите высоту полупирамиды: ";
- cin >> heigth;
- }while(!(heigth > 1 && heigth < 24));
- for(int y = 1; y <= heigth; y++)
- {
- SetCursorPosition(0, y + 3);
- for(int j = 1; j < heigth - y + 1; j++ ) cout << ' ';
- for(int a = 1; a < y + 2; a++ ) cout << '#';
- cout << endl;
- }
- system("pause");
- }
- -------------------------------
- 4
- #include <iostream>
- #include <clocale>
- #include <windows.h>
- using namespace std;
- void main()
- {
- setlocale(LC_ALL, "Russian");
- system("mode con cols=80 lines=40");
- double credit;
- int balance;
- int _25cent = 0, _10cent = 0, _5cent = 0, _1cent = 0;
- do
- {
- system("cls");
- cout << "Введите долг продавца(Например 9.75): ";
- cin >> credit;
- } while (credit < 0);
- balance = (int)(credit * 100);
- while (balance > 0)
- {
- if (balance >= 25)
- {
- balance -= 25;
- _25cent++;
- }
- else if (balance >= 10)
- {
- balance -= 10;
- _10cent++;
- }
- else if (balance >= 5)
- {
- balance -= 5;
- _5cent++;
- }
- else if (balance >= 1)
- {
- balance -= 1;
- _1cent++;
- }
- }
- cout << "\nВам выдали монеты номиналом:\n\n";
- cout << "25 центов: " << _25cent << " шт.\n";
- cout << "10 центов: " << _10cent << " шт.\n";
- cout << "5 центов: " << _5cent << " шт.\n";
- cout << "1 цент: " << _1cent << " шт.\n";
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment