ممكن حل الاسايمنت ماعليكم امر مااعرف احله :-
Chap12 home assignment
member's functions:
- Use the same class of the last lab and add the following
- constructor with default parameters
The constructor must output the following message:"Object has been created".
- Empty strings(" ") for StudentFName and StudentLName)
- 0 for the StudentScore.
void increasegrade(float);
- Destructor function that output the following message:"Object has been deleted".
- A function to that increase the grade by an amount.
· Use the same class of the last lab and add the following
member's functions:1) constructor with default parameters
· Empty strings(" ") for ItemName and ItemType)
· 0 for the ItemPrice.
The constructor must output the following message:"Object has been created".
2) Destructor function that output the following message:"Object has been deleted".
3) IncreasePrice which adds an amount to the ItemPrice of the object.
MenuType::MenuType()
{
ItemName=" ";
ItemType=" ";
ItemPrice=0;
cout<<endl;
}
Destructor function
MenueType::~MenuType()
{
cout<<"Object has been deleted ";
cout<<endl;
}
IncreasPrice by amount
void MenuType::IncreasPrice(float amount)
{
ItemPrice=ItemPrice+amount;
cout<<endl;
}
هذا حل الاسايمنت الا طاف والاسايمنت هذا يعتمد على اللي قبله
هل بحيث ان نزيد حل الاسايمنت هذا على الاسايمنت اللي قبل؟ ولا نبدل ولا شنو ؟
#include<iostream>
#include<string>
using namespace std;
class studentType {
private:
string FName;
string LName;
float testScore;
public:
void SetData(string,string,float);
void GetData(string&,string&,float&);
bool Samescore(const studentType&);
};
void studentType::SetData(string f ,string l ,float s)
{
FName=f;
LName=l;
if(0<=s && s<=100)
testScore=s;
}
void studentType::GetData(string &f ,string &l ,float &s)
{ f=FName;
l=LName;
s=testScore;
}
bool studentType::Samescore(const studentType &st)
{
if(testScore == st.testScore)
return true;
else
return false;
}
int main()
{
studentType S1,S2;
string f,l;
float s;
bool R;
cout<<"Enter first and last name , and testScore : ";
cin>>f>>l>>s;
S1.SetData(f,l,s);
cout<<endl;
cout<<"Enter first and last name , and testScore : ";
cin>>f>>l>>s;
S2.SetData(f,l,s);
cout<<endl;
R=S1.Samescore(S2);
if(R)
cout<<"score of S1 = score of S2 "<<endl;
else
cout<<"score of S1 not equal score of S2 "<<endl;
cout<<endl;
cout<<"All data of student (S1) : "<<endl;
S1.GetData(f,l,s);
cout<<"Name = "<<f<<" "<<l<<endl;
cout<<"His/her test score = "<<s<<endl;
cout<<endl;
system("pause");
return 0;
في احد يقدر يحل الاسايمنت قبل الساعه 11 ونص؟
جاني الم اسنان وماقدرت احله , فاذا احد بيتبرع يحله رحم الله والديكم
#include<iostream>
#include<string>
using namespace std;
class Email{
private:
string from;
string to;
string body;
int size;
public:
Email( ); //default
~Email();
void setEmail(string, string, string, int);
void getEmail(string &, string &, string &, int &) ;
void print( ) const;
};
Email:: Email( ){
from=""; to=""; body=""; size=0;
}
Email::~Email( ){
cout<<"Email Deleted";
}
void Email :: setEmail(string f, string t, string b, int s)
{
from = f; to=t; body=b; size=s;
}
void Email:: getEmail(string &f, string &t, string &b, int &s)
{
f=from; t=to; b=body; s=size;
}
void Email::print( ) const{
cout<<"From="<<from<<endl;
cout<<"To="<<to<<endl;
cout<<"Body="<<body<<endl;
cout<<"Size in bytes="<<size<<endl;
}
int largestEmail(Email list[ ], int length)
{
string Fromi, Toi, Bodyi, FromL, ToL, BodyL;
int Sizei, SizeL;
int largeIndex=0; //assume the first email at index zero has the largest size
for(int i=1; i<length; i++)
{
list[i].getEmail(Fromi, Toi, Bodyi, Sizei);
list[largeIndex].getEmail(FromL, ToL, BodyL, SizeL);
if(Sizei > SizeL)
largeIndex=i;
}
return largeIndex;
}
int main()
{
Email list[3];
list[0].setEmail("[email protected]", "[email protected]","Hello111",34);
list[0].setEmail("[email protected]", "[email protected]","Hello22",3);
list[0].setEmail("[email protected]", "[email protected]","Hello33",30);
cout<<"Largest Email at index = "<<largestEmail(list, 3);
system("pause");
return 0;
}
ممكن شرح ال classes and Data Abstraction لانه باجر عندي اختبارابي شرح استفيد منه للاختبار
//write the defnetion of a structer type named movie to represnt a movie in video shop .
//the structers has the following members :
//Title (string) , Numberofcopies(int) , movietype(string)
//1- write one statment to declare FamilyMovie as a stuctere of type movie .
//2- write one statment to declare an array ListMovies of type movie of size 10.
//3- write statments to read data of 10 movies and store them in ListMovie .
//4- write staments to print data for all "comedy" movies in ListMovie .
//5- write statments to search and print titles of all movies with 0 numberofcopies in ListMovie.
struct
movie
{
string title;
int numberofcopies;
string movietype;
}
movie FamilyMovie;
movie ListMovies[10];
for
(int i=0 ; i<10 ; i++)
cin >> ListMovies[i].title >>
" ">> ListMovies[i].numberofcopies >>" ">> ListMovies[i].movietype;
for
(int i=0
اختي عاشقة الدموع
هذا حل العضو ITCS Student
PHP:#include<iostream> #include<string> using namespace std; class Email{ private: string from; string to; string body; int size; public: Email( ); //default ~Email(); void setEmail(string, string, string, int); void getEmail(string &, string &, string &, int &) ; void print( ) const; }; Email:: Email( ){ from=""; to=""; body=""; size=0; } Email::~Email( ){ cout<<"Email Deleted"; } void Email :: setEmail(string f, string t, string b, int s) { from = f; to=t; body=b; size=s; } void Email:: getEmail(string &f, string &t, string &b, int &s) { f=from; t=to; b=body; s=size; } void Email::print( ) const{ cout<<"From="<<from<<endl; cout<<"To="<<to<<endl; cout<<"Body="<<body<<endl; cout<<"Size in bytes="<<size<<endl; } int largestEmail(Email list[ ], int length) { string Fromi, Toi, Bodyi, FromL, ToL, BodyL; int Sizei, SizeL; int largeIndex=0; //assume the first email at index zero has the largest size for(int i=1; i<length; i++) { list[i].getEmail(Fromi, Toi, Bodyi, Sizei); list[largeIndex].getEmail(FromL, ToL, BodyL, SizeL); if(Sizei > SizeL) largeIndex=i; } return largeIndex; } int main() { Email list[3]; list[0].setEmail("[email protected]", "[email protected]","Hello111",34); list[0].setEmail("[email protected]", "[email protected]","Hello22",3); list[0].setEmail("[email protected]", "[email protected]","Hello33",30); cout<<"Largest Email at index = "<<largestEmail(list, 3); system("pause"); return 0; }
#include <iostream>
#include <string>
using namespace std;
class Date
{
private:
int day;
int month;
int year;
public:
void Setallmembers(int ,int , int);
void Getallmembers(int& ,int& , int& );
void PrintC();
Date( );
~Date( );
};
void Date::Setallmembers(int d,int m,int y)
{
day=d;
month=m;
year=y;
}
void Date::Getallmembers(int& d,int& m,int& y)
{
d=day;
m=month;
y=year;
}
void Date::PrintC(){;
{
cout<<day<<"/"<<month<<"/"<<year;
cout<<endl;
}
}
Date::Date()
{
day=1;
month=1;
year=1900;
}
Date::~Date()
{
cout<<endl;
cout<<"The Object Termenited";
cout<<endl;
}
int main()
{
Date H;
int d;
int m;
int y;
H.PrintC();
cout<<endl;
{
{
cout<<"Please Insert Day: ";
cin>>d;
while(d<1 || d>31)
{
cout<<"Error with day!!"<<endl;
cout<<"Please insert Day again: ";
cin>>d;
}
}
{
cout<<"Please Insert Month: ";
cin>>m;
while(m<1 || m>12)
{
cout<<"Error With Month!!"<<endl;
cout<<"Please Insert Month Again: ";
cin>>m;
}
}
{
cout<<"Please Insert Year: ";
cin>>y;
while(y<1900 || m>2100)
{
cout<<"Error With Month!!"<<endl;
cout<<"Please Insert Year Again: ";
cin>>y;
}
}
H.Setallmembers(d,m,y);
}
cout<<endl;
H.PrintC();
system("pause");
return 0;
}