Mavzu : C++ dasturlash tilida obyektga yo’naltirilgan dasturlashdan foydalansh .
Masala : Qoshiqchilar guruhi berilgan uning maydonlariga qiymat o’zlashtirilsin.
Dastur kodi quyidagicha :
#include
#include
using namespace std;
class musician
{
public :
string group_name;
string album_name;
int cassette;
int number_of_songs;
string date;
string name_of_studio;
public :
void input();
void output();
};
void musician::input()
{
cout<<"Gruh nomi : "; cin>>group_name;
cout<<"Albom nomi " ; cin>>album_name;
cout<<"Kassette " ; cin>>cassette;
cout<<"Qoshiqlar soni :" ; cin>>number_of_songs;
cout<<"Ishlab chiqilgan sana : " ; cin>>date ;
cout<<" studia nomi : " ; cin>>name_of_studio;
}
void musician::output()
{
cout<<"-------------------------------"<cout<cout<cout<cout<cout<cout< }
int main(int argc, char** argv) {
musician m;
m.input();
m.output();
return 0;
}
Do'stlaringiz bilan baham: |