Function class $C^{\infty}$ Show that exists function $ g \in \mathcal{C}^{\infty} \ [\mathbb{R},[0,1]) $ such that $g(x)=0$ for $|x|\le 1/2$ and $g(x)=1$ for $|x|>1$.
So, I have :
$f(x)=\begin{cases} \exp(-1/x) &\text{for } x > 0\\0 &\text{for } x<0 \end{cases}$
And now:
$g(x) = \frac{f(x)}{f(x) + f(1-x)}$
However, I am not convinced of this.

You are correct, your $g$ isn't right as user247327 has pointed out. But we can use it to construct the right $g$ by stretching and translating it a bit. Let $h(x) = \frac{f(x)}{f(x)+f(1-x)}$. Note that this function is $1$ for $x>1$ and $0$ for $x < 0$. Out of this function we will construct $g$.
First of all observe that the function $x \mapsto h(2x-1)$, is precisely what we need for $g(x)$ if $x>0$ . Meaning if $x < 1/2$ we have $h(2x-1) = 0$ and if $x >1$ we have $h(x) =1$. We also see that we need to have $g(x) = g(-x)$, so we can simply set
$$
g(x) = h(2x-1) + h(-1-2x)
$$
and we're done.
