#include <math.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <unistd.h>
using namespace std;
const int MAX = 100000;
class IO {
private:
ifstream in;
ofstream out;
char s[MAX];
char* s2;
public:
IO() {
out.open("in.txt", ifstream::binary);
out.write(s, MAX);
out.close();
s2 = new char[MAX];
for (int i = 0; i < MAX; i++) {
s[i] = '*';
s2[i] = '*';
}
}
void read(int n) {
in.open("in.txt", ifstream::binary);
in.read(s2, n);
in.close();
}
void write(int n) {
out.open("out.txt", ifstream::binary);
out.write(s, n);
out.close();
}
};
int main(int argc, char** argv) {
struct timespec t = {0, 20000000};
int y1 = 0;
int y2 = 0;
IO *f = new IO();
for (int i = -90; i < 1080; i++) {
y1 = (int)(MAX / 2.0 * (1.0 + cos(i / 180.0 * 3.14)));
y2 = (int)(MAX / 2.0 * (1.0 + cos((i + 90) / 180.0 * 3.14)));
f->write(y1);
f->read(y2);
nanosleep(&t, NULL);
}
return (EXIT_SUCCESS);
}

© 2008 - 2012 Солдатов Валерий Фёдорович
Ваши комментарии и замечания.