Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Eric Johnson
- //04-16-12
- //simple ARRAY
- #include <iostream>
- #include "screen.hpp"
- using namespace std;
- void intvalid (int* data) { //For ints
- while(cin.fail()) { //Input validation loop
- cin.clear(); //Clear flags
- cin.ignore(255,'\n'); //Clear input buffer
- cout<<"Invalid Input - Please input a number:";
- cin>>(*data);
- }
- }
- //enumerated type definition
- int main()
- {
- enum {p200_299,p300_399,p400_499,p500_599,p600_699,p700_799,p800_899,p900_999,p1000_over};
- int pay[9];
- for (int i=0; i<9; i++)
- pay[i]=0;
- string response;
- cout << "Which pay range would you like to increment? (1-9): ";
- do
- {
- cin >> response;
- }
- while (intvalid))
- char run=NULL;
- //implement as for loop
- do{
- response=screen(pay);
- //intvalid(&response);
- while (response != 1
- &&response != 2
- &&response != 3
- &&response != 4
- &&response != 5
- &&response != 6
- &&response != 7
- &&response != 8
- &&response != 9)
- {switch (response)
- {
- case 0:
- pay[p200_299] ++;
- break;
- case 1:
- pay[p300_399] ++;
- break;
- case 2:
- pay[p400_499] ++;
- break;
- case 3:
- pay[p500_599] ++;
- break;
- case 4:
- pay[p600_699] ++;
- break;
- case 5:
- pay[p700_799] ++;
- break;
- case 6:
- pay[p800_899] ++;
- break;
- case 7:
- pay[p900_999] ++;
- break;
- case 8:
- pay[p1000_over] ++;
- break;
- }}
- cout << "Would you like to run again? (y/n)";
- }//end of switch & while
- while(response!='x');
- }
Advertisement
Add Comment
Please, Sign In to add comment