I'm Learning Exception Handling And now I Have a problem with Exception Specifications!

The terminate( ) and unexpected( ) functions simply call other functions to actually handle
an error. As just explained, by default terminate( ) calls abort( ), and unexpected( ) calls
terminate( ).
Right? But look at my code :

Code:
// Test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>     
#include <stdexcept>
#include <exception>
using namespace std;

void test(int a) throw()
{
	if(a != 0)
		cout << "a = " << a << endl;

	else
		throw runtime_error("a == 0");
}


int main () 
{

	
	int a;
	while(cin >> a)
	{
		try
		{
			cout << "Test invoked!\n";
			test(a);
		}

		catch(runtime_error &r)
		{
			cout << r.what();
		}
	}

	return 0;
}
is Should terminate because of test function can't Throw!Am I Right?
But it works correctly until user enters Ctrl+Z!

even I try Some Codes From internet But they Don't Work properly either!
like :

Code:
#include <iostream>       // std::cerr
#include <exception>      // std::set_unexpected

void myunexpected () {
  std::cerr << "unexpected called\n";
  throw 0;     // throws int (in exception-specification)
}

void myfunction () throw (int) {
  throw 'x';   // throws char (not in exception-specification)
}

int main (void) {
  std::set_unexpected (myunexpected);
  try {
    myfunction();
  }
  catch (int) { std::cerr << "caught int\n"; }
  catch (...) { std::cerr << "caught some other exception type\n"; }
  return 0;
}
it Should Print :
unexpected called
caught int
But in My Compiler(VS 2010) output is :

caught some other exception type
I'm Confused!