//No.1 #include #include using namespace std; int main() { setlocale(LC_ALL, "Russian"); double s, n, p; cout << "Введите размер займа в рублях" << endl; cin >> s; cout << "Введите на сколько лет взят займ" << endl; cin >> n; cout << "Введите процент займа" << endl; cin >> p; double r = p / 100; if (pow((1 + r), n) != 1) cout << "m = " << (s * r * pow((1 + r), n)) / (12 * (pow((1 + r), n) - 1)) << endl; else cout << "Ошибка \n"; return 0; } //No.2 #include #include using namespace std; int main() { setlocale(LC_ALL, "Russian"); cout << "Введите размер займа в рублях" << endl; double S, m, n; cin >> S; cout << "Введите размер месячной выплаты в рублях" << endl; cin >> m; cout << "Введите срок выплаты займа" << endl; cin >> n; double L = 0, R = 100; const double pogr = 1e-5; while (R - L > pogr) { double now = (L + R) / 2.0, r = now / 100.0; if (((S * r * pow(1 + r, n)) / (12 * (pow(1 + r, n) - 1))) > m) R = now - pogr; else L = now; } cout << "p = " << L; return 0; } //No.3 #include #include using namespace std; int main() { setlocale(LC_ALL, "Russian"); ofstream fout("file.txt"); for (size_t i = 0; i < 10; ++i) fout << rand() % 11 << endl; fout.close(); ifstream fin("file.txt"); cout << "Содержимое файла: " << endl; int value; while (fin >> value) cout << value << endl; fin.close(); return 0; } //No.4 #include #include #include #define MAX_NUM 100 using namespace std; int main() { setlocale(LC_ALL, "Russian"); srand(time(0)); ofstream fout("file.txt"); for (int i = 0; i < 20; ++i) { bool is_char = rand() % 2; string chars = "QWERTYUIOPASDFGHJKLZXCVBNM"; if (is_char) fout << chars[rand() % chars.length()] << endl; else fout << rand() % MAX_NUM << endl; } fout.close(); ifstream fin("file.txt"); string str; while (fin >> str) { bool isnumber = true; for (char c : str) if (c < '0' || c > '9') { isnumber = false; break; } if (isnumber) cout << str << endl; } fin.close(); return 0; } //No.5 #include #include #include using namespace std; void alfavitSort(string str) { sort(str.begin(), str.end()); cout << str; } int main() { SetConsoleCP(1251); SetConsoleOutputCP(1251); setlocale(LC_ALL, "Russian"); cout << "Введите символы" << endl; string s; cin >> s; cout << "Результат:" << endl; alfavitSort(s); return 0; }