Create a class called prompt in C++ language.Pass its constructor function a prompting string of your choice.Have the constructor display the string and then input...

      

Create a class called prompt in C++ language.Pass its constructor function a prompting string of your choice.Have the constructor display the string and then input an integer.Store this value in a private variable called count.When an object of type prompt is destroyed, ring the bell on the terminal as many times as the user entered.

  

Answers


Davis
#include
using namespace std;
class prompt {
int count;
public :
prompt (char *s) { cout << s; cin>> count; };
~prompt();
};
prompt::~prompt() {
int i, j;
for(i=0; icout << '\a';
for(j=0; j<32000; j++); //delay
}
}
int main()
{
prompt ob("Enter a number: ");
return 0;
}
Githiari answered the question on May 12, 2018 at 16:38


Next: Is the following fragment valid? union { float f; unsigned int bits; };
Previous: Create a class called dice that contains one private integer variable.Create a function called roll() that uses the standard randomn number generator, rand(), to generate...

View More Computer Science Questions and Answers | Return to Questions Index


Exams With Marking Schemes

Related Questions