67 020
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #53592 in C++ for Chanel Maughmer

Question #53592
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?
Expert's answer
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);
}
};



int main()
{
intRange a(332676);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions