Let me assume you want $a,b,x$ to be (nonnegative) real numbers. One solution is to:
Write decimal expansions of $a,b$, and then let $x$ be the number whose decimal expansion has $a$'s digits in the even powers of 10 and $b$'s digits in the odd powers of 10. (With $b$'s 1's place in the 10's place.) For example:
$a = 2.002\overline{4}$
$b = 337.99575$
$x = 303072.909052745\overline{40}$
Addendum:
Per Arthur's comment, what you want is an injective function from the set of pairs $\mathbb{R}\times\mathbb{R}$ to $\mathbb{R}$ (the set of real numbers). This exists because $\mathbb{R}$ is infinite. In general, if $A$ is an infinite set, there is an injective function from $A\times A$ to $A$.
When Arthur said, "it won't be pretty," he was referring to the fact that it's often not possible to make such a function "well-behaved" in ways we are used to.
For example, the function I just described is highly disconinuous. It fails to be continuous at values of the inputs that have 2 different decimal expansions like $0.399999... = 0.40000...$. It is not possible to give a continuous injective function from $\mathbb{R}\times\mathbb{R}$ to $\mathbb{R}$. (Proof, for those who know some point-set topology: Suppose $f$ were such an injection. Restrict $f$ to the unit disc. As the disc is compact and connected, its image is a compact connected subset of $\mathbb{R}$, i.e. a closed interval. Thus $f$ induces a continuous bijection from a disc to a closed interval. This is impossible because a continuous bijection between compact hausdorff spaces is a homeomorphism, but a disc is not homeomorphic to a line segment.)
Second addendum: This is getting a little afield of the OP, but, since I engaged with Arthur's comments in the first addendum, I should mention that I just looked for a reference to the claim that if $A$ is infinite, there is an injection from $A\times A$ to $A$ (equivalently, that $A\times A$ and $A$ have the same cardinality), and discovered to my surprise that the general statement of this fact requires the axiom of choice, and is actually equivalent to the axiom of choice in ZF! See here and here. (However, in the situation of $A=\mathbb{R}$, there is no need for it, as shown in the totally explicit map $\mathbb{R}^{\geq 0}\times\mathbb{R}^{\geq 0}\rightarrow\mathbb{R}^{\geq 0}$ described above.)