Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. #include"stdafx.h"
  2. #include<iostream>
  3. using namespace std;
  4.  
  5. class Persona
  6. {
  7. private:
  8. char*name;
  9. char*second_name;
  10. char*family_name;
  11. int EGN;
  12. public:
  13. void Input() {
  14. char ime[20];
  15. cout<<"Input name:" <<endl;
  16. cin>>ime;
  17. name=new char[strlen(ime)+1];
  18. for(int i=0;i<=strlen(ime);i++)
  19. name[i]=ime[i];
  20.  
  21. char prezime[20];
  22. cout<<"Input name2:"<<endl;
  23. cin>>prezime;
  24. second_name=new char[strlen(prezime)+1];
  25. for(int i=0;i<=strlen(prezime);i++)
  26. second_name[i]=prezime[i];
  27.  
  28. char familiq [20];
  29. cout<<"Input name3:"<<endl;
  30. cin>>familiq;
  31. family_name=new char[strlen(familiq)+1];
  32. for(int i=0;i<=strlen(familiq);i++)
  33. family_name[i]=familiq[i];
  34.  
  35. char egn [20];
  36. cout<<"Input egn:"<<endl;
  37. cin>>egn;
  38.  
  39. }
  40.  
  41. void Output();
  42. ~Persona() {
  43. delete[] name;
  44. delete[] second_name;
  45. delete[] family_name;
  46. }
  47. };
  48.  
  49. class Student:public Persona
  50. {
  51. private:
  52. double fak_nomer;
  53. char*spec;
  54. double sr_uspeh;
  55. public:
  56. void Input();
  57. void Output();
  58. ~Student() {delete[]spec;}
  59. };
  60.  
  61. int main()
  62. {
  63. Persona a;
  64. a.Input();
  65.  
  66. int item[100];
  67. int a, b, t;
  68. int count;
  69.  
  70. /*Прочитане на числата*/
  71. cout<<"how many numbers?";
  72. cin>>count;
  73. for(a=0; a<count; a++) cout<<item[a];
  74.  
  75. /*Сортиране чрез метода на мехурчето*/
  76. for(a=0; a<count; ++a)
  77. for(b=count-1; b>a; --b){
  78.  
  79. /*Сравняване на съседни елементи*/
  80. if(item[b-1] > item[b]){
  81. t = item[b-1];
  82. item[b-1] = item[b];
  83. item[b] = t;
  84. }
  85. }
  86.  
  87. /*Изписване на числата*/
  88. for(t=0; t<count; t++) cout<<"Chisloto e:"<< item[t]);
  89.  
  90.  
  91. bool swapped = true;
  92. int j = 0;
  93. int tmp;
  94. while (swapped) {
  95. swapped = false;
  96. j++;
  97. for (int i = 0; i < n - j; i++) {
  98. if (arr[i] > arr[i + 1]) {
  99. tmp = arr[i];
  100. arr[i] = arr[i + 1];
  101. arr[i + 1] = tmp;
  102. swapped = true;
  103. }
  104. }
  105. }
  106.  
  107.  
  108. for (int i = 0; i<5; i++)
  109. cout << array[i].getN() << "\t";
  110.  
  111.  
  112. return 0;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement