>I want to put an if statement to make sure that
>no letters are entered and only numbers are?
You can't control what the user types without delving pretty far into non-standard stuff. You'd essentially need to write your own shell code for handling raw input and the restrict echoing (and storage as well) based on the scan code.
Normally we stick to the standard error handling loop:
#include <ios>
#include <iostream>
#include <limits>
int main()
{
int bottles;
bool done = false;
for ( ; ; ) {
std::cout<<"How many bottles in the basket? ";
if ( std::cin>> bottles )
break;
// Clean up the mess
std::cin.clear();
std::cin.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );
std::cerr<<"Invalid input\n";
}
std::cout<<"You entered "<< bottles <<'\n';
}