#include <iostream.h>
#include <stdlib.h>
int main()
{
int j;
char k[4]= "123";
j = static_cast<int>( k[0]);
cout<<j<<endl;
system("PAUSE");
return 0;
}
I am writing a program where i receive a string with numbers in it. My program has to validate those numbers. I try to cast the numbers to an intiger for easier validation.
This program will run om win. using Borland.
The problem i'm having is that j contains the dec value of of 1.
I want j to comtain the number 1 not the decimal value of 1.
How do i do that.