How to convert isbn 13 to isbn 10?

Need help with C++ program please help!?

  • I'm having problems with this program, if you run it more than one time the hst total is way wrong! Can someone please help me? The ISBN numbers to test with are 11110, 12221, 13332, 24443, 25554. #include <iostream> #include <process.h> #include <iomanip> #include <conio.h> #include <string> #include <stdio.h> #include <ctype.h> #include <windows.h> using namespace std; void gotoxy(int x, int y) { COORD coord; coord.X = x; //column coordinate coord.Y = y; //row coordinate SetConsoleCursorPosition(GetStdHandle(… coord); } void clrscr(int x, int y) { COORD coordScreen = { x, y }; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y; FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); GetConsoleScreenBufferInfo(hConsole, &csbi); FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); SetConsoleCursorPosition(hConsole, coordScreen); } int main() { int i, qty, y; float retail[5] = {155.95, 116.75, 126.50, 125.75, 138.99}, total, pretotal, tax, aftertotal; string book_title[5] = {"Binary Kibbles and Bits", "Underwater Googles", "Vitamin C++", "Surf and Turf the Web", "Java-lin: Olympic Favourite"}, isbn[5] = {"11110", "12221", "13332", "24443", "25554"}, isbn_num = "0"; bool valid=true; char runagain='y'; while(runagain=='y') { clrscr(0,0); runagain='y'; total=0; pretaxtotal=0; aftertotal=0; qty=0; tax=.13; y=3; valid=true; gotoxy(5,2); cout << "ISBN"; gotoxy(12,2); cout << "Title"; gotoxy(40,2); cout << "Price"; gotoxy(50,2); cout << "Qty"; gotoxy(57,2); cout << "Total"; cout << fixed; cout.precision(2); do { isbn_num="0"; gotoxy(5,y); cin >> isbn_num; for(i=0;i<5;i++) { if(isbn_num==isbn[i]) { gotoxy(12,y); cout << book_title[i]; gotoxy(40,y); cout << "$"<<retail[i]<<""; gotoxy(50,y); cin >> qty; total=retail[i]*qty; pretaxtotal=pretotal+total; gotoxy(57,y); cout << "$"<<total<<""; y++; i=0; runagain = getch(); if(runagain=='t') { valid=false; break; } valid=true; break; } } if(i==5) { clrscr(5,y); gotoxy(12,y); cout << "Invalid ISBN"; continue; } if(y>7) { valid=false; break; } while(valid==true) { tax=hst*pretaxtotal; aftertotal=tax+prepretaxtotal; gotoxy(40,y+5); cout << "PreTax Total"; gotoxy(57,y+5); cout << "$"<<pretaxtotal<<endl; gotoxy(40,y+6); cout << "Hst(13%)"; gotoxy(57,y+6); cout <<"$"<< hst<<endl; gotoxy(40,y+7); cout << "After Tax Total"; gotoxy(57,y+7); cout << "$"<<aftertotal<<endl; gotoxy(5,y+10); cout << "Would you like to enter another purchase? (y/n) "; cin >> runagain; } return(0); }

  • Answer:

    Just clear up some codes.... Good luck!

Tom at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.