After reading input with >>, cin contains a newline (from pressing Enter). getline next sees the newline, consumes it and thinks it has already read a line of input. So you get to another prompt to repeat.
When mixing getline and >>, you'll need to clean the stream from left-over characters after using >>.
Code:
#include <limits>
...
cin.ignore(numeric_limits<streamsize>::max(), '\n');
Other notes:
I'm using Visual C++ 6.0.
I guess an upgrade is suggested since that compiler does not support standard C++ correctly.
Code:
#include <iostream.h>
#include <cmath>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "stdio.h"
It is strange that you know about <cmath> but not that the same thing applies to all standard C headers in C++: drop the extension and prepend 'c'. Also there's no <iostream.h>, it's <iostream> (standard headers don't have an extension) and all standard identifiers live in the std namespace. Hence:
Code:
#include <iostream>
#include <cmath> //you don't seem to be using anything from this one
#include <cstdlib>
#include <cstring>
#include <cctype> //I guess you'll also need to use toupper from this one
#include <cstdio> //you are not using this one
using namespace std;