Advertisement
Guest User

Untitled

a guest
May 25th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. template <typename T>
  7. class spisok{
  8. protected:
  9. T *mas;
  10. int count;
  11. friend void vvodF(spisok&);
  12. friend void vuvodF(spisok);
  13. public:
  14. spisok(){};
  15. void setter(){
  16. int n;
  17. while(true){
  18. cout<<"Vvedite kolichestvo elementov : ";cin>>n;
  19. if(cin.good() && n>0)
  20. break;
  21. cin.clear();
  22. cout<<"Nevernuy vvod!"<<endl;
  23. cin.ignore(100,'\n');
  24. }
  25. count = n;
  26. mas = new T[count];
  27. T tmp;
  28. for(int i = 0;i<count;i++){
  29. while(true){
  30. cout<<"Mas["<<i+1<<"]=";
  31. cin>>tmp;
  32. if(cin.good())
  33. {
  34. *(mas+i) = tmp;
  35. break;
  36. }
  37. cin.clear();
  38. cout<<"Nevernuy vvod!"<<endl;
  39. cin.ignore(100,'\n');
  40. }
  41. }
  42. }
  43. void vvod(){
  44.  
  45. }
  46. void vuvod(){
  47.  
  48. }
  49. T begin(){
  50. return *(mas);
  51. }
  52. T end(){
  53. return *(mas + count);
  54. }
  55.  
  56. };
  57. void vvodF(spisok& a){
  58.  
  59. }
  60. void vuvodF(){
  61.  
  62. }
  63. void main () {
  64. spisok<int> a;
  65. spisok<char> b;
  66. a.setter();
  67. b.setter();
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement