Use the CharRange class. The IntRange class should allow the user to enter integer values within a specified range. An error message should be displayed when the user enters a value outside the range. Demonstrate the class by wriiting a simple program that uses it. Could you write a simple program for this?
1
Expert's answer
2015-08-14T02:51:12-0400
Answer
#include <iostream> using namespace std;
class intRange { private: int n; public: void Range(long long int t) { if (t>32767||t<-32767) { cout<<"Error"; n=NULL; }else {n=int(t); cout<<"Okay\n"<<n;}; } intRange(long long int n) { Range(n); } };
Comments
Leave a comment