Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- template <typename T>
- class spisok{
- protected:
- T *mas;
- int count;
- friend void vvodF(spisok&);
- friend void vuvodF(spisok);
- public:
- spisok(){};
- void setter(){
- int n;
- while(true){
- cout<<"Vvedite kolichestvo elementov : ";cin>>n;
- if(cin.good() && n>0)
- break;
- cin.clear();
- cout<<"Nevernuy vvod!"<<endl;
- cin.ignore(100,'\n');
- }
- count = n;
- mas = new T[count];
- T tmp;
- for(int i = 0;i<count;i++){
- while(true){
- cout<<"Mas["<<i+1<<"]=";
- cin>>tmp;
- if(cin.good())
- {
- *(mas+i) = tmp;
- break;
- }
- cin.clear();
- cout<<"Nevernuy vvod!"<<endl;
- cin.ignore(100,'\n');
- }
- }
- }
- void vvod(){
- }
- void vuvod(){
- }
- T begin(){
- return *(mas);
- }
- T end(){
- return *(mas + count);
- }
- };
- void vvodF(spisok& a){
- }
- void vuvodF(){
- }
- void main () {
- spisok<int> a;
- spisok<char> b;
- a.setter();
- b.setter();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement