Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <cmath>
- #include <fstream>
- #include <string>
- using namespace std;
- void hw3_1();
- void hw3_2();
- void hw3_3();
- void hw3_4();
- void hw3_5();
- int main()
- {
- setlocale(LC_ALL, "russian");
- hw3_1();
- /*hw3_2();
- hw3_3();*/
- /*hw3_4();
- hw3_5();*/
- return 0;
- }
- void hw3_1() {
- float p, m, S, r;
- int n;
- cout << "Введите p, S, n: ";
- cin >> p >> S >> n;
- if (p > 0 && S > 0 && n > 0) {
- r = p / 100;
- m = (S*r*pow(1 + r, n)) / (12 * (pow(1 + r, n) - 1));
- cout << "m=" << m << endl;
- }
- else cout << "p, S, n должны быть больше 0!" << endl;
- }
- void hw3_2() {
- float p, m, S, r;
- int n;
- cout << "Введите S, n, m: ";
- cin >> S >> n >> m;
- }
- void hw3_3() {
- char ch;
- ifstream fin;
- fin.open("D:\\hw3\\kpop.txt");
- while (fin.get(ch)) {
- cout << ch;
- }
- fin.close();
- }
- void hw3_4() {
- char ch;
- ifstream fin;
- fin.open("D:\\hw3\\kpop.txt");
- while (fin.get(ch)) {
- if ((ch >= '0' && ch <= '9') || ch==' ' || ch=='\n') {
- cout << ch;
- }
- }
- fin.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement