Continuous function $f$ such that $f(\mathbb{Q}) \subset \mathbb{R} - \mathbb{Q}$ and $f(\mathbb{R} - \mathbb{Q}) \subset \mathbb{Q}$
(I know this question has already been asked and answered but there the idea used was the cardinality of $\mathbb{Q}$ and $\mathbb{R}$ and $\mathbb{Q}$. Here I want to try another idea- as described in my outline Reference: Continuous function that take irrationals to rationals and vice-versa..)
My attempt: I choose $m = 3$ and $c \in \mathbb{Q}$ and draw a family of lines $L_c: y = 3x + c$. If such a $f(x)$ exists and if $f(x) \cap L_c \neq \emptyset$, then they intersect at $x$.
Two cases follow:
Case I: $x$ is rational.
Then $y = 3x + c \in \mathbb{Q}$ a contradiction to the definition of $f(x)$.
Case II: $x$ is irrational.
Then $y = 3x + c \in \mathbb{R} - \mathbb{Q}$ again a contradiction to the definition of $f(x)$.
So my plan is draw the family $L_c$ on $\mathbb{R^2}$ and show that $f(x)$ intersection atleast one of the line
Now if I don't want $f(x)$ to intersect $L_c$, then I have the following inequality $$3x + c < f(x) < 3x + c + \frac{1}{n}.$$
I keep increasing $n$ and hence reach the conclusion that no such $f(x)$ exists. The problem with my proof is I want my conclusion to be $f(x) = 3x + c, c\in \mathbb{R} - \mathbb{Q}$. Can someone fix my proof.