Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <Windows.h>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- setlocale(LC_ALL, "Russian");
- int k = _ttoi(argv[2]);
- HANDLE connect = CreateFile(argv[1], GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
- if (connect == INVALID_HANDLE_VALUE){
- cout << "Ошибка."<< k <<" "<<GetLastError()<<endl;
- return 0;
- }
- double q = 23.14069263277926;
- DWORD buf;
- double res = (double)24.0 / k * (3 / (pow(q, k) - 1) - 4 / (pow(q, 2 * k) - 1) + 1 / (pow(q, 4 * k) - 1));
- wchar_t buffer[BUFSIZ];
- if (!WriteFile(connect, &res, sizeof(res), &buf, NULL)){
- cout << "Не может быть записано. "<<endl;
- return 0;
- }
- CloseHandle(connect);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement