samp in your class is a stream varable, streams are, in general, non-copyable. The normal way to design something like this is to have a friend >> operator.
Code:
class Crypt {
...
friend std::istream & operator >> (std::istream &, Crypt &);
};
std::istream & operator >> (std::istream &is, Crypt &c) {
return is >> c.n >> c.p;
}
int main() {
Crypt cval;
if(std::cin >> cval) {
cval.calculate();
...
}
}
You may also want to call calculate() from within the >> operator, so that k is always valid. You may also want to read the values into local varables and only change the target Crypt if all input operations succeed.