Ok, so I am trying to get my program to do something simple. It has to display either a "1", for any number entered that is illegal for an unassigned short int , a "2" if it overflows, or the number entered if it works fine.
I was trying to do the input as such:
-skip leading spaces
-first character is numeric or an error occurs
-each numeric character is processed individually and then combined
-process stops when a non-numeric character is found.
Problem is, I don't know how to do that so I used this sstream instead...
To understand what I'm saying, here's the code.
Any help at all would be appreciated.
Also note that "cin >> variable" is comepltely unwanted for this.
-----------
#include <iostream>
#include <sstream>
using namespace std;
int ReadInt(unsigned short int &Shortint);
void main()
{
unsigned short int Shortint;
char Yesno, R;