At7ady
04-01-2005, 06:21 AM
السلام عليكم ورحمة الله وبركاته
عندي عمل مكتبه بلغة السي المطلوب فيها menu اضافة كتاب حذف كتاب البحث عن كتاب
وطبعا البحث كان يحتاج مني array of objects للاسف ما عرفت استخدمه شوفولي هالبرنامج والله تعبني والي يعافيكم لا تبخلون علينا
#include<iostream>
#include<string>
using namespace std;
class Book{
private:
string Author;
string Publisher;
string Country;
string ISBN;
public:
Book(void){} //default constructor
Book(string auther,string publisher,string country,string isbn)
{ Author=auther;
Publisher=publisher;
Country=country;
ISBN=isbn;
} // initialization constructor
///////////////////////////
void DeleteBook(Book& b)const;
;bool isValid(string isbn);
string return_ISBN(){return ISBN;}
string return_country(){return Country;}
string return_author(){return Author;}
string return_publisher(){return Publisher;}
};//end of class
void Book::DeleteBook(Book& b)const//func deletebook
{
b.return_author()=" ";
b.return_country()=" ";
b.return_ISBN()=" ";
b.return_publisher()=" ";
}//end deleteBook
bool Book::isValid(string isbn)//func isvalid
{string no;
if(isbn.empty())
{cout<<"The ISBN is empty ,enter ISBN :";
cin>>no;
isbn=no;}//end if
int sum=0;
sum+=(int)isbn[0];
for(int i=2;i<5;i++)
sum+=(int)isbn[i];
for(int c=6;c<11;c++)
sum+=(int)isbn[c];
if(isbn[13]=='X' || isbn[13]=='x')
sum+=10;
if(sum%11==0)
return true;
else
return false;
}//end isValid*/
وهذا الكلاس تبعه
عندي عمل مكتبه بلغة السي المطلوب فيها menu اضافة كتاب حذف كتاب البحث عن كتاب
وطبعا البحث كان يحتاج مني array of objects للاسف ما عرفت استخدمه شوفولي هالبرنامج والله تعبني والي يعافيكم لا تبخلون علينا
#include<iostream>
#include<string>
using namespace std;
class Book{
private:
string Author;
string Publisher;
string Country;
string ISBN;
public:
Book(void){} //default constructor
Book(string auther,string publisher,string country,string isbn)
{ Author=auther;
Publisher=publisher;
Country=country;
ISBN=isbn;
} // initialization constructor
///////////////////////////
void DeleteBook(Book& b)const;
;bool isValid(string isbn);
string return_ISBN(){return ISBN;}
string return_country(){return Country;}
string return_author(){return Author;}
string return_publisher(){return Publisher;}
};//end of class
void Book::DeleteBook(Book& b)const//func deletebook
{
b.return_author()=" ";
b.return_country()=" ";
b.return_ISBN()=" ";
b.return_publisher()=" ";
}//end deleteBook
bool Book::isValid(string isbn)//func isvalid
{string no;
if(isbn.empty())
{cout<<"The ISBN is empty ,enter ISBN :";
cin>>no;
isbn=no;}//end if
int sum=0;
sum+=(int)isbn[0];
for(int i=2;i<5;i++)
sum+=(int)isbn[i];
for(int c=6;c<11;c++)
sum+=(int)isbn[c];
if(isbn[13]=='X' || isbn[13]=='x')
sum+=10;
if(sum%11==0)
return true;
else
return false;
}//end isValid*/
وهذا الكلاس تبعه