Advertisement
Konark

Untitled

Apr 5th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <Windows.h>
  4.  
  5. using namespace std;
  6.  
  7. int _tmain(int argc, _TCHAR* argv[])
  8. {
  9.         setlocale(LC_ALL, "Russian");
  10.         int k = _ttoi(argv[2]);
  11.         HANDLE connect = CreateFile(argv[1], GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
  12.         if (connect == INVALID_HANDLE_VALUE){
  13.             cout << "Ошибка."<< k <<" "<<GetLastError()<<endl;
  14.             return 0;
  15.         }
  16.         double q = 23.14069263277926;
  17.         DWORD buf;
  18.         double res = (double)24.0 / k * (3 / (pow(q, k) - 1) - 4 / (pow(q, 2 * k) - 1) + 1 / (pow(q, 4 * k) - 1));
  19.         wchar_t buffer[BUFSIZ];
  20.         if (!WriteFile(connect, &res, sizeof(res), &buf, NULL)){
  21.             cout << "Не может быть записано. "<<endl;
  22.             return 0;
  23.         }
  24.         CloseHandle(connect);
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement