1234567891011121314151617181920212223242526272829303132333435363738394041
#include <iostream> #include <ctype.h> #include <string> using namespace std; class Checker { string s; char ch; int pos; public: Checker() {} void enterString() { cout << "Enter string: "; getline(cin, s); } void enterPosition() { cout << "Enter position: "; cin >> pos; } void check() { ch = s.at(pos); bool check = isdigit(ch); if (check == 0) cout << ch << " type char" << endl; else cout << ch << " type int " << endl; } }; int main() { Checker ch; ch.enterString(); ch.enterPosition(); ch.check(); system("pause"); return 0; }