Commands for your command prompt:
1. quit-Your program should keep prompting for new commands until the user entered the command quit. This is similar to lab7 bonus part.
2. range The lowerBound and upperBound were initialized to some certain value, but the user could reset it to any range they want, as long as it is a valid range. When the user enter this command, it will be prompted to enter two integer numbers for lower bound and upper bound as well as the condition they have to satisfy. If the user entered a set of invalid range, the original range will stay intact; otherwise, lowerBound and upperBound will be reset to the values given
I am completely confused. Here is what I have:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string words[10];
string command;
int lowerbound;
int upperbound;
int x;
int y;
lowerbound=0;
upperbound=9;
cout<<"Enter a command for range 0 - 9:"<<"\n";
cin>>command;
while (command != "quit")
{
if (command=="range")
{
cout<<"Enter a lower bound and upper bound so that 0 <= lower bound <=upper bound < 10:"<<"\n";
cin>>x;
cin>>y;
if ((0<=x) && (x <= y) && (y <10))
{
cout<<"Enter another commmand for range "<<x<<" - "<<y<<":\n";
lowerbound=x;
upperbound=y;
}
else
{
cout<<"Invalid range, range stays as "<<lowerbound<<" - "<<upperbound<<":\n";
cout<<"Enter another command for range 2 - 2:\n";
}
}
}
cout<<"Quitting the program.";