Question
Write a program that prompts the nuser to enter the first 9 digits of an ISBN and disply the 10-digit ISBN (including leading zeros) Here
Write a program that prompts the nuser to enter the first 9 digits of an ISBN and disply the 10-digit ISBN (including leading zeros)
Here is what I didi but it's not running help please
the formula is (1 * d1 + 2 * d2 + 3 * d3 + 4 * d4 + 5 * d5 + 6 * d6 + 7 * d7 + 8 * d8 + 9 * d9) % 11;
#include
using namespace std;
int main() { string val, isbn; int check; double val; cout<< "Enter the first 9 digits of an ISBN "; cin.get >> val; if (val.size() == 9); { check = ((val[0] - 48) * 1 + (val[1] - 48) * 2 + (val[2] - 48) * 3 + (val[3] - 48) * 4 + (val[4] - 48) * 5 + (val[5] - 48) * 6 + (val[6] - 48) * 7 + (val[7] - 48) * 8 + (val[8] - 48) * 9) % 11; if (check < 10) isbn = val + char(check + 48); else isbn = val + "X"; cout << "The ISBN 10 number is " << isbn;
} else cout << "ivalid input"; cout << endl; system("pause") return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started