//--------------------------------------------------------------------------- #pragma hdrstop //ASSIGNMENT 2, TASK 2 JANE JAKEMAN #pragma argsused //DATE COMPLETED 16 JAN 2006 #include //PROGRAM GETS A NUMBER, VALIDATES, CALCULATES #include //AND OUTPUTS WHETHER VALID OR NOT WITH A CHOICE #include //TO CONFIRM DATA ENTRY, AND LOOP TO CONTINUE #include #include //FILENAME: A2T2ISBNNumbers using namespace std; //used with converting character to integer char ISBN[11]; //ISBN to hold char array char ch; //ch to input char,put in array int loop=0; //used for loop int x=0; //used for loop int y=10; //used for multiplication loop (ten, down to 1) int total=0; //used to hold result of ISBN calc int ans=0; //used to hold the answer to checksum int check; //used to hold ans divided by 11 to checksum const int d=11; //used to allocate 11 as constant char ynone, yntwo; //used for two Y/N requests char quit; //used to close program void getISBN (void); //declare prototype of getISBN void correctno(void); //declare prototype is no correct? void calculate (void); //declare prototype of calculate void yesno (void); //declare prototype of yesno void close (void); //declare prototype to close void main(void) //start of main { //open main getISBN(); //call functions in order correctno(); calculate(); yesno(); close(); } //close main //FUNCTION GET ISBN void getISBN(void) //start of code for function getISBN { //open getISBN loop=0; //set loop to 0 cout<<"\n\nPlease enter the ISBN number\n"; //ask user for input do //start of do { //open do ch=getch(); //get character, put it in ch if ((ch>='0'&&ch<='9')||((ch=='x')||(ch=='X'))) //validate input { //open if ISBN[loop]=ch; //put character in ISBN[0] loop++; //add 1 to loop, will fill array } //close if }while(loop<10); //while condition, fills array toISBN[9] ISBN[10]='\0'; //ends array cout<<"\n\nThe number you entered is : " <