#include<iostream.h>
#include<conio.h>
class control
{
public:
control()
{
calculate();
cout<<endl<<"nnttConstructor";
}
v...
void main()
{
clrscr();
control c1;
getch();
}
OUTPUT:
#include<iostream.h>
#include<conio.h>
class book
{
char publication[20];
float price;
}bk;
int main()
{
clrscr();
cout<<"...
OUTPUT:
/* Program to declare a class journal having data members as
journal_nm,price,issn_no. Accept this data for two objects an...
}
void display()
{
cout<<"nnttName of Journal having gretaer price is : "<<name;
}
};
void main()
{
int i;
clrscr();
journ...
j[1].display();
}
getch();
}
OUTPUT:
/Program to declare a class “Day” having data members as
hours,min,sec.Accept min from user convert in appropriate
hours,m...
}
};
void main()
{
clrscr();
Day d;
d.accept();
getch();
}
OUTPUT:
Upcoming SlideShare
Loading in …5
×

Pratik Bakane C++

486 views
290 views

Published on

Pratik Bakane C++ programs...............This are programs desingedby sy diploma student from Governement Polytecnic Thane.....programsare very easy alongwith coding andscreen shot of the output

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
486
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Pratik Bakane C++

  1. 1. #include<iostream.h> #include<conio.h> class control { public: control() { calculate(); cout<<endl<<"nnttConstructor"; } void calculate() { display(); cout<<"nnttCalculator"; } void display() { cout<<endl<<"nnttDisplayed"; } };
  2. 2. void main() { clrscr(); control c1; getch(); } OUTPUT:
  3. 3. #include<iostream.h> #include<conio.h> class book { char publication[20]; float price; }bk; int main() { clrscr(); cout<<"nntt"<<sizeof(book)<<"nntt"<<sizeof(bk); getch(); }
  4. 4. OUTPUT:
  5. 5. /* Program to declare a class journal having data members as journal_nm,price,issn_no. Accept this data for two objects and display the journal having greater price */ #include<iostream.h> #include<conio.h> class journal { public: char name[20]; int issn_no,price; public: void accept() { cout<<"nnttEnter the Journal Name : "; cin>>name; cout<<"nnttEnter the ISSN number : "; cin>>issn_no; cout<<"nnttEnter the Price : "; cin>>price;
  6. 6. } void display() { cout<<"nnttName of Journal having gretaer price is : "<<name; } }; void main() { int i; clrscr(); journal j[2]; for(i=0;i<2;i++) { j[i].accept(); } if(j[0].price>j[1].price) { j[0].display(); } else {
  7. 7. j[1].display(); } getch(); } OUTPUT:
  8. 8. /Program to declare a class “Day” having data members as hours,min,sec.Accept min from user convert in appropriate hours,min,sec.Display it for one object of class./ #include<iostream.h> #include<conio.h> class Day { private: int hours,min, sec; public: void accept() { cout<<"nnttEnter minutes : "; cin>>min; hours = min/60; cout<<"nntthour : "<<hours<<endl; min = min-(hours*60); cout<<"nnttmin : "<<min<<endl; sec=30; cout<<"nnttsec : "<<sec<<endl;
  9. 9. } }; void main() { clrscr(); Day d; d.accept(); getch(); }
  10. 10. OUTPUT:

×