is it possible to use a for loop with this code
   
  #include <iostream>
using namespace std;
class Book {
 string ISBN;
 string title;
 string author;
 int copyright_date;
 bool checked;
  public:
 Book(string isbn, string t, string a, int c, bool ch):ISBN(isbn), title(t), 
author(a), copyright_date(c), checked(ch){}
 string get_isbn() {return ISBN;}
 string get_title() {return title;} 
 string get_author() {return author;} 
 int get_copyright() {return copyright_date;} 
 bool get_checked() {return checked;}
};
  bool check_isbn(string isbn) {
 if (isbn.size() == 13) {
  if (
   isdigit(isbn[0]) && 
   isdigit(isbn[1]) && 
   isdigit(isbn[2]) &&
   isbn[3] == '-' &&
   isdigit(isbn[4]) &&
   isdigit(isbn[5]) &&
   isdigit(isbn[6]) &&
   isbn[7]== '-'  &&
   isdigit(isbn[8]) &&
   isdigit(isbn[9]) &&
   isdigit(isbn[10]) &&
   isbn[11] == '-'  &&
   isalpha(isbn[12]) ) {
    return true;
  }
 } else return false;
 
}
  int main() {
 Book b("123-321-238-x", "The Water", "Grisham", 1980, true);
 cout << b.get_isbn()<<endl;
 cout << b.get_title() << endl;
 cout << b.get_author() << endl;
 cout << b.get_copyright() << endl;
 cout << check_isbn(b.get_isbn()) << endl;
 if (b.get_checked() == true)
  cout << "checked out\n";
 else cout << "not checked out" << endl;
}

 
---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

[Non-text portions of this message have been removed]

Reply via email to