I'm rusty and I need help
Code:
#include <iostream.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main()
{
string num;
int x = 0;
cout << "Input a Number.\n";
cin >> num;
x = strlen('num');
string numLast = num.substr(x, -1);
switch ('numLast')
{
case '1': cout << num << "st.\n";
break;
case '2': cout << num << "nd.\n";
break;
case '3': cout << num << "rd.\n";
default: cout << "\n" << num << "th.\n";
}
system("PAUSE");
return 0;
}
This is basically a going to be a function that returns wether a number is a st, nd, rd or a th. If ya know what I mean. :D
Any help is appreciated. Thanks. :)