templet program
Page 1 of 1
templet program
please debug
- Code:
#include<iostream>
using namespace std;
template<class xx>
class a
{
public:
xx *ar;int l;xx sum;
a(int r)
{
l=r;
ar=new xx[l];
}
void getc()
{
for(int i=0;i<l;i++)
{
cin>>ar[i];
}
}
void sum()
{
for(int i=0;i<l;i++)
{
sum+=ar[i];
}
}
void print()
{
cout<<endl<<sum;
}
};
main()
{
int b;
cin>>b;
a<int> aa(10);
aa.getc();
aa.sum();
aa.print();
}
akarshsomani- Posts : 21
Join date : 2017-04-04
Similar topics
» please check the error and correct the program
» Overloading new and delete operator program
» IP6: Write a C++ program that uses the concept of hybrid inheritance.
» Program related to Object Slicing : Why the output is not coming In Base a=2 ?
» Program given by sir i.e given in Reema Thareja on Overloading of new and delete operators is not working . Debug it !!
» Overloading new and delete operator program
» IP6: Write a C++ program that uses the concept of hybrid inheritance.
» Program related to Object Slicing : Why the output is not coming In Base a=2 ?
» Program given by sir i.e given in Reema Thareja on Overloading of new and delete operators is not working . Debug it !!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|