Code:#include<iostream.h>
#include<conio.h>
int main(){
clrscr();
int i; char * c;
cin>>c;
i=*c;
if(i<48 || i>57)return 0;
else cout<<i<<" "<<c; getch(); return 0;}
Printable View
Code:#include<iostream.h>
#include<conio.h>
int main(){
clrscr();
int i; char * c;
cin>>c;
i=*c;
if(i<48 || i>57)return 0;
else cout<<i<<" "<<c; getch(); return 0;}
the PROBLEM IS THAT ONCE THE PROGRAM IS DONE... IT DOES NOT RETURN BACK TO CODING SCREEN
I see a multitude of problems. I suggest that you:
- Upgrade your compiler.
- Get rid of non-standard clrscr (see faq for alternatives).
- Reading into a pointer that is non-initialized is undefined behavior. Read into an int or a char.
- Don't use an if statement to check if it's a char; use std::isdigit to check if it's a digit (if it's not, it's likely a char).
- Get rid of getch. See SourceForge.net: Pause console - cpwiki for alternatives on pausing the console.
- Change iostream.h to iostream.