// CBC encrypt // #include #include double drand(void) { return rand()/(RAND_MAX+1.0); } // random value in the range [0.0,1.0) int main( void) { double r, plain, cipher, prev = 0; srand(123456); // replace 123456 with the first six digits of your number from a6/p2 while( scanf("%lf",&plain) == 1) // until error or end-of-file { r = 20*drand() - 10; // random value -10.0 ... +10.0 cipher = plain + prev + r; // CBC encrypt using addition printf("%g\n", cipher); prev = cipher; // save for previous ciphertext } return 0; }