Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This problem is slightly more difficult than the above problem. This one require

ID: 3624391 • Letter: T

Question

This problem is slightly more difficult than the above problem. This one requires a data type that stores 10 digits. Background Publishers and bookstores use a number system called the International Standard Book Number (ISBN) system to identify books At the start of publication, each book is assigned a unique ISBN. An ISBN, once assigned, can never be re-used Click here for detailed information on this numbering system. An ISBN consists of exactly 10 digits. The rightmost digit is the check digit the check digit is validated modulo 11. multiply each digit from the first to the ninth by a weight from 10 to 2 respectively (the first digit by 10, the second by 9 mldr., the ninth by 2). the sum of the products plus the check digit should be divisible without remainder by 11. if there is a remainder, the whole number is not a valid ISBN Consider the following example: Design a program that validates an ISBN Your program keeps accepting a whole number and determining if that whole number is a valid ISBN. Your program terminates when the user enters 0 as the whole number The output from your program looks something like: the data type long only guarantees room for 9 digits. The data type long only guarantees room for an integer with well over 12 digits (at least 64 bits of precision) The conversion specifier for a long long integer is %lld. The Borland 5.5 compiler docs not include the long long data type, but instead provides int64 and % I 64d instead of % lld as the conversion specifier. Suppose epsi is a constant given by preprocessor directive statement # define epsi 0.0001 write a program which input x real (double type) number, then calculate c* approximately by the formula: here n is the lira integer for which epsi is satisfied Additional requirements Draw a (low chart on separate paper OR write pseudo-code as comment at the beginning of your programs to explain you algorithm.

Explanation / Answer

Exercise 1. file main.cpp

/* Input and check ISBN number*/

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <string.h>

main()

{

      while(1)

      {

              system("cls");

              long long isbn, llphu, llsodu, llcheck, lls;

              char cchoice;

              int n=0;

              printf(" Welcome to checking ISBN number system! ");

              printf(" Choose one of the following options: ");

              printf(" 1. Enter ISBN number ");

              printf(" 0. Exit ");

              printf("Your selection <0 -> 1>: ");

              scanf("%c",&cchoice);

              if(cchoice=='0')

              {

                           printf("Good bye, have a nice day! ");

                           getch();

                           break;

              }

              if(cchoice!='0' && cchoice!='1') printf(" **Invalid choice. Try again.** ");

              if(cchoice =='1')

              {

                        printf("ISBN validator: ");

                        printf("=============== ");

                        printf("<Valid ISBN:0003194876 ");

                        printf("ISBN <1 character fo finish>:");

                        scanf("%lld", &isbn);

                        llphu=isbn;

                        while (llphu>0)

                        {

                              llsodu=llphu%10;

                              llphu=(llphu-llsodu)/10;

                              n=n+1;

                              lls=lls+llsodu*n;

                        }

                        llcheck=lls%11;

                        if (llcheck==0) printf("this ISBN is valid!");

                        else printf("this ISBN is not valid");

              }

              printf(" Press any key to continue...");

              getch();                                              

      }

}

Exercise 2: file main.cpp

/* Input and check ISBN number*/

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <string.h>

main()

{

      long isbn, llphu, llsodu, llcheck, lls;

      int n=0;

      while(1)

      {

              system("cls");

              printf("ISBN validator: ");

              printf("=============== ");

              printf("ISBN (0 to quit): ");

              scanf("%ld", &isbn);

              if(isbn==0)

              {

                           printf("Have a Nice Day! ");

                           getch();

                           break;

              }

              if (isbn>0)

              {

                        llphu=isbn;

                        while (llphu>0)

                        {

                              llsodu=llphu%10;

                              llphu=(llphu-llsodu)/10;

                              n=n+1;

                              lls=lls+llsodu*n;

                        }

                        llcheck=lls%11;

                        if (llcheck==0) printf("This is a valid ISBN.");

                        else printf("This is not a valid ISBN.");

              }

              printf(" Press any key to continue...");

              getch();                                              

      }

}

/* Input and check ISBN number*/

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <string.h>

main()

{

      while(1)

      {

              system("cls");

              long long isbn, llphu, llsodu, llcheck, lls;

              char cchoice;

              int n=0;

              printf(" Welcome to checking ISBN number system! ");

              printf(" Choose one of the following options: ");

              printf(" 1. Enter ISBN number ");

              printf(" 0. Exit ");

              printf("Your selection <0 -> 1>: ");

              scanf("%c",&cchoice);

              if(cchoice=='0')

              {

                           printf("Good bye, have a nice day! ");

                           getch();

                           break;

              }

              if(cchoice!='0' && cchoice!='1') printf(" **Invalid choice. Try again.** ");

              if(cchoice =='1')

              {

                        printf("ISBN validator: ");

                        printf("=============== ");

                        printf("<Valid ISBN:0003194876 ");

                        printf("ISBN <1 character fo finish>:");

                        scanf("%lld", &isbn);

                        llphu=isbn;

                        while (llphu>0)

                        {

                              llsodu=llphu%10;

                              llphu=(llphu-llsodu)/10;

                              n=n+1;

                              lls=lls+llsodu*n;

                        }

                        llcheck=lls%11;

                        if (llcheck==0) printf("this ISBN is valid!");

                        else printf("this ISBN is not valid");

              }

              printf(" Press any key to continue...");

              getch();                                              

      }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote