موقع طلبة جامعة البحرين

يمكنك تصفح الموقع كزائر ولكن ندعوك لتسجيل عضوية خاصة بك لتحصل على كافة الصلاحيات مثل تنزيل ملفات المكتبة وقراءة تعليقات هيئة التدريس وغيرها. يمكنك الحصول على عضوية مجانية بالضغط على زر تسجيل. إذا قمت بالتسجيل مسبقا فيمكنك الضغط على زر دخول.

تسجيل دخول
  • قسم المكتبة الجامعية مغلق مؤقتا بعد الاستهداف التي تعرضت له بعض خدمات أمازون في البحرين، جاري استرجاع الملفات ونقلها إلى سيرفرات جديدة وسيتم بعدها اعادة افتتاح المكتبة

ITCS112 - ITCS104 - ITCS102 للفصل الصيفي 2014 - 2015

هذا اني اللي سويته
class PlateType {
private:
string It_Name ;
float It_Price;
string It_Type;
public:
void SetData( string It_Name, float It_Price ,string It_Type);
void GetData ( string It_Name, float It_Price ,string It_Type);
float IncreasePrice(float It_Price );
void showData( string It_Name, float It_Price ,string It_Type);
void PlateType ::SetData( string It_Name, float It_Price ,string It_Type){
name=It_Name;
price=It_Price ;
type=It_Type;}
void PlateType ::GetData (It_Name, It_Price , It_Type);
It_Name=name;
It_price=price;
It_Type=type;}
float
PlateType ::IncreasePrice(It_Price ){
float amount;
amount= amount+ It_price
It_price= amount;}
 
class PlateType {
private:
string It_Name ;
float It_Price;
string It_Type;
public:
void SetData( string It_Name, float It_Price ,string It_Type);
void GetData ( string It_Name, float It_Price ,string It_Type);
float IncreasePrice(float It_Price );
void showData( string It_Name, float It_Price ,string It_Type);

في أول خطوة ارتكبت عدة اخطاء

الأول ان في البوبلك مايصير تحط اسماء الاشياء الي راح تعرفها .. تحط بس نوعها
وبالاضافة ان الفنكشن الثانية المفترض يكون نوعها string مو void
ولازم القيم الي فيها تكون ريفرنس
والفنكشن الثالثة يصير void بدل float
هذا الحل الصحيح للخطوة رقم 1

HTML:
class PlateType {

    private:
    string It_Name ;
    float It_Price;
    string It_Type;
    public:
    void SetData(string, float, string);
    string GetData(string&, float&, string&);
    void IncreasePrice(float);
    void showData(string, float,string);

};


void PlateType ::SetData( string It_Name, float It_Price ,string It_Type){
name=It_Name;
price=It_Price ;
type=It_Type;}
void PlateType ::GetData (It_Name, It_Price , It_Type);
It_Name=name;
It_price=price;
It_Type=type;}
float PlateType ::IncreasePrice(It_Price ){
float amount;
amount= amount+ It_price
It_price= amount;}

في الخطوة الثانية الـ setdata لازم تعرف ليها قيم في البروتوتايب غير الي عرفتها في البرايفت
وبعدين داخل الفنكشن
تساوي القيم الموجودة في البرافيت بالقيم الموجودة في بروتوتايب الفنكشن

HTML:
    void PlateType::SetData(string name, float price ,string type)
    {
    It_Name=name;
    It_Price=price;
    It_Type=type;
    }

وفي الـ GetData نفس الشي في البروتوتايب تعرف قيم غيير
وداخل الفنكشن
تحط ليها القيم الي موجودة في البرايفت
وبعدين تسوي ريتيرن للقيم

HTML:
    string PlateType::GetData(string& name, float& price ,string& type)
    {
    name = It_Name;
    price = It_Price;
    type = It_Type;
    return (name, price, type);
    }


وفي الـ IncreasePrice في البروتوتايب تعرف عدد وهذا العدد بكون مقدار الزيادة في السعر
وداخل الفنكشن تجمع سعر السلعة مع مقدار الزيادة في السعر

HTML:
    void PlateType::IncreasePrice(float amount)
    {
    It_Price+=amount;
    }


وفي الـ showData تسوي كول للفنكشن GetData
وبعدين تطبع القيم

HTML:
    void PlateType::showData(string name, float price,string type)
    {
    GetData(name, price, type);
    cout<<"ItemName:"<<name<<"  ItemPrice:"<<price<<"BD  ItemType:"<<type<<endl;
    }

وفي الـ main تعرف الكلاس والقيم الي عرفتها في البرايفت

HTML:
    PlateType plate1;
    string It_Name, It_Type;
    float It_Price=0.0;

وتسوي كول لفنكشن setdata وتحط فيها القيم الي عطوك اياها

HTML:
    plate1.SetData("Baryani", 3.0, "Lunch");

وتسوي كول لفنكشن IncreasePrice وتحط فيه مقدار الزيادة في السعر

HTML:
    plate1.IncreasePrice( 0.2 );

وآخر شي تسوي كول لفنكشن showData عشان تطبع لك القيم

HTML:
    plate1.showData(It_Name, It_Price, It_Type);

وأي سؤال ثاني حاضرين

وبالتوفيق ان شاء الله

نسألكم صالح الدعاء
​
 
مرحبااا ..

إذا ممكن مساعدة ،
بغيت استعمل البرنامج .. بس مو ضابط ويايي..
يظلع لي مثل ما في الصورة ..
وما عارفة شلون أعالج الموضوع ..!

/// شكراً مقدماً ..!
​
 

المرفقات

  • Picture1.webp
    Picture1.webp
    21.7 KB · المشاهدات: 40
مرحبااا ..

إذا ممكن مساعدة ،
بغيت استعمل البرنامج .. بس مو ضابط ويايي..
يظلع لي مثل ما في الصورة ..
وما عارفة شلون أعالج الموضوع ..!

/// شكراً مقدماً ..!
​

مختاره نوع البروجكت غلط
روحي new project واختاري اللغه السي بلس بلس وعقب اختاري empty project
عقب روحي سوي new file واختاري نوع cpp file
 
اللهم صل على محمد و آل محمد

الـ OutPut خطأ وين الخلل ؟

كود:
# include <iostream>
كود:
[FONT=comic sans ms][COLOR=#000000]# include <string>[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]using namespace std;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]    class PlateType {[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]private: string Name;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        float Price;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        string Type;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]public: void SetData (string ,float , string );[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        string GetData (string& ,float& ,string& );[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        void IncreasePrice(float );[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        void showData (string ,float ,string );};[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]
[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]    void PlateType::SetData(string a, float b, string c){[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        Name=a; Price=b; Type=c;}[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]    string PlateType::GetData(string & d,float &e,string &f){[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        d=Name; e=Price; f=Type;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        return (Name,Price,Type);}[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]    void PlateType::IncreasePrice(float g){[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        Price+=g;}[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]    void PlateType::showData (string Name,float Price,string Type){[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        cout<<Name<<Price<<Type;}[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]    void main(){[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        PlateType plate1;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        string na;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        float pr=0.0;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        string ty;[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        plate1.SetData("Baryani",3.0,"Lunch");[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        plate1.IncreasePrice(2.0);[/COLOR][/FONT]
[FONT=comic sans ms][COLOR=#000000]        plate1.showData(na,pr,ty);}[/COLOR][/FONT]


اللهم صل على محمد و آل محمد
​
 
مختاره نوع البروجكت غلط
روحي new project واختاري اللغه السي بلس بلس وعقب اختاري empty project
عقب روحي سوي new file واختاري نوع cpp file

file > new project >win32 > empty project < new Item < c++ ( cpp) .. !​
لسّى ما ضبط !!

// شكراً جزيلاً وعذراً على الازعاج ..!
 

المرفقات

  • Picture1.webp
    Picture1.webp
    23.8 KB · المشاهدات: 31
اللهم صل على محمد و آل محمد

الـ OutPut خطأ وين الخلل ؟

​

بالنسبة الى getData
string PlateType::GetData(string & d,float &e,string &f){
d=Name; e=Price; f=Type;
return (Name,Price,Type);}

اذا ترجعين الداتا ريفرنس ما يحتاج تسوين ريترن بعد + لو كان في الريترن بترجع شي واحد مو جدي تسوينه

فنكشن show تطبع الاشياءات الموجوده في الكلاس المفروض ما فيها براميتر >> ما تاخذ شي من المين
 


file > new project >win32 > empty project < new Item < c++ ( cpp) .. !​

لسّى ما ضبط !!

// شكراً جزيلاً وعذراً على الازعاج ..!

انتي قاعده تشوفين property manager الملفات مال البروجكت موجوده في solution explorer روحي في البرنامج view واختاري solution explorer وبتشوفين فيها ملفات البروجكت
 
اللهم صل على محمد و آل محمد

Pirate : في الـ return شفت علامات تعجب مسويه قلت يمكن بعد يصير
:whistling:
مشكور ,,, على وجهك في الجنة
:nosweat:


اللهم صل على محمد و آل محمد


​
 
الميدتيرم لاي درس ؟
 
ممكن تحلون هالسؤال

ما عرفت ليه اصلا رايحة عليي في class



Consider the following structure Date
struct Date{
int month;
int day;
int year;
};
Use the class EmployeeInfo that uses the Date structure in solving the problem below
class EmployeeInfo
{
private:
int ID;
string firstname;
string lastname;
double salary;
Date hiredate;
public:
void setInfo(int, string, string, double, date);
int getID() const;
string getFname() const;
string getLname() const;
double getSalary() const;
Date getDate();
EmployeeInfo ();
EmployeeInfo (int,string,string,double,Date);
};


Write the code for each member functions.
Write a program that defines array of EmployeeInfo of size 15. The program should ask the user to enter the data of those employees and store them in the array. Then the program displays the information of employee that has largest salary.​
 
هلا العقل السليم
اني في سكشن 4 و عطونا هذا السؤال ... كل ما اسوي فيه مو راضي يستوي !! يطلع ليي 42 error و لا اعرف اطلعهم
جنني:RpS_mad: ..... يا ريت الا يعرف يفيدنا :tears:
 
1- شعب , شنو الفرق بين الـ class والـ struct ؟
2-الكلاس عادة يكون فيه داتا ممبر + ممبر فنكشن
الستركت : اكثر شي يكون فيه داتا ممبر , بدون فنكشن بس ممكن نخلي فيه فنكشن , يصير ؟
 
اني في هالسؤال الي ما عرفت اسويه هو في هالجزء ..
Write a program that defines array of EmployeeInfo of size 15. The program should ask the user to enter the data of those employees and store them in the array. Then the program displays the information of employee that has largest salary

شلون ادخل معلومات بطريقه الفور لووب ..

>> رجعت من السفر واحس كلشيء تبخر ..

بلييز ردو عليي اليوم المغرب تبينا نطرش لها الاسايمنت
 
ممكن تحلون هالسؤال

Write the code for each member functions.
Write a program that defines array of EmployeeInfo of size 15. The program should ask the user to enter the data of those employees and store them in the array. Then the program displays the information of employee that has largest salary.​

هلا العقل السليم
اني في سكشن 4 و عطونا هذا السؤال ... كل ما اسوي فيه مو راضي يستوي !! يطلع ليي 42 error و لا اعرف اطلعهم
جنني:RpS_mad: ..... يا ريت الا يعرف يفيدنا :tears:

اني في هالسؤال الي ما عرفت اسويه هو في هالجزء ..

شلون ادخل معلومات بطريقه الفور لووب ..

>> رجعت من السفر واحس كلشيء تبخر ..

بلييز ردو عليي اليوم المغرب تبينا نطرش لها الاسايمنت

فنكشن الست المفروض تاخذ بيانات وتحطهم في الفاريبل الموجودين في الكلاس
void EmployeeInfo :: setInfo(int i, string f, string l, double s, date h)
{
ID = i;
firstname = f;
ومثل الشي الى الباقي
}
فنكشن القت ترجع ديتا
int EmployeeInfo ::getID() const
{
return ID;
}
ومثل الشي بعد باقي الفنكشن


الكونستكتور مثل فنكشن set


المين يبون نعرف اوبجكت من هذه الكلاس


EmployeeInfo employees[15];


وعلشان اقرء ملعوماتهم اعرف فاريبل اخزن فيها المعلومات وعقب اسوي كول الى فنكشن الست


for( i =0 ..... i<15 )
{
cin >> i >> firstname >> ...
employees.setInfo( i ,firstname .. );
}


وعقب يبون احسب الماكس


int pos = 0;
for( i =0 ..... i<15 )
if( employees.getSalary() > employees[pos].getSalary() ) pos = i


عقب اللوب صار عندنا الاندكس الى الموظف اللي عنده اكبر راتب نطبع بياناته




cout << employees[pos].getID() << ...



1- شعب , شنو الفرق بين الـ class والـ struct ؟
2-الكلاس عادة يكون فيه داتا ممبر + ممبر فنكشن
الستركت : اكثر شي يكون فيه داتا ممبر , بدون فنكشن بس ممكن نخلي فيه فنكشن , يصير ؟

الكلاس والستركجر مثل الشي عادي نحط فيهم فنكشن وكونستكتور الفرق الوحيد انه الممبر في الكلاس الديفولت برايفت والستركجر الديفولت ببلك
 
عودة
أعلى أسفل