• Embed Doc
  • Readcast
  • Collections
  • 1
    CommentGo Back
Download
 
Program - 1Write a c++ program that sorts an array of number sort functionto be overloaded to support both integer array and float array.
Template<class T>Class sort{T a[10];Public:Void insert(){For(i=0;i<10;i++){Cout<<”enter value”;Cin>>a[i];}Void sort{T temp;For(i=0;i<=n-1;i++){For(j=1;j<=n-I;j++){If (a[j]>a[j+1]){Temp=a[j]A[j]=a[j+1]A[j+1]=temp}}}}Main(){Sort<int>s1;S1.insert();
 
S1.sort();Sort<float>s2;S2.sort();}
 
Program – 2An electricity board charge following rate for domestic user todischarge large cunsesion of For first 100 units 60 per unitFor next 200 units 80 per unitBeyond 300 units 90 per unitAll users are charge minimum of rupees 50 all the total amountif more than rupees 300 than additional charge 15% it addedwrite a program to read the name of users and number of unitconsume and print out the charge with name.
Class ele-bill{Char name[10];Int unit;Float bill;Public:Void getdetail(){Cout<<”enter person details”;Cin>>name>>unit;If(unit<=100){Bill=unit*60;If(bill<50){Bill=50;}}Else if (unit>101 && unit<=300){Bill=unit*80;}Else{
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...