We have
$$\int_0^x \cos(\pi t)\,dt=\left[\frac{\sin(\pi t)}{\pi}\right]_0^x=\frac{\sin(\pi x)}{\pi}\ ;$$
this continues to oscillate between $1/\pi$ and $-1/\pi$ and therefore has no limit as $x\to\infty$. Hence
$$\int_0^\infty \cos(\pi t)\,dt$$
diverges, and so does
$$\int_{-\infty}^\infty \cos(\pi t)\,dt\ .$$
I thought it might be instructuve and of interest to present an approach to evaluating the integral $\int_{-\infty}^\infty e^{-x^2}\cos(nx)\,dx$ that does not rely on direct integration. To that end we proceed.
Let $f(y)$ be represented by
$$f(y)=\int_{-\infty}^\infty e^{-x^2}\cos(xy)\,dx \tag1$$
Differentiating $(1)$ under the integral reveals
$$f'(y)=-\int_{-\infty}^\infty xe^{-x^2}\sin(xy)\,dx\tag2$$
Integrating by parts the integral in $(2)$ with $u=-\sin(xy)$ and $v=-\frac12e^{-x^2}$, we obtain
$$\begin{align}
f'(y)&=-\frac12y\int_{-\infty}^\infty e^{-x^2}\cos(xy)\,dx\\\\\
&=-\frac12yf(y)\tag3
\end{align}$$
From $(3)$, we see that $f(y)$ satisfies the ODE $f'(y)+\frac12yf(y)=0$, subject to $f(0)=\sqrt\pi$. The solution to this ODE is trivial and is given by
$$f(y)=\sqrt\pi e^{-y^2/4}\tag4$$
Setting $y=n$ in $(4)$ yields
$$\int_{-\infty}^\infty e^{-x^2}\cos(nx)\,dx=\sqrt\pi e^{-n^2/4}$$
Letting $n\to \infty$, we find the coveted limit is $0$.
Best Answer
Because $(\cos(x)-\sin(x)) \leq 1-x$ over the range of integration, an upper bound for the integral is $$\int_{0}^{1} (1-x)^n dx.$$ But, $$\lim_{n \rightarrow \infty} \int_{0}^{1} (1-x)^n dx = \lim_{n \rightarrow \infty} \frac{1}{n+1} = 0.$$
Because the original integral is positive for all $n$, the limit must be zero by the Squeeze theorem.