Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include"stdafx.h"
- #include<iostream>
- using namespace std;
- class Persona
- {
- private:
- char*name;
- char*second_name;
- char*family_name;
- int EGN;
- public:
- void Input() {
- char ime[20];
- cout<<"Input name:" <<endl;
- cin>>ime;
- name=new char[strlen(ime)+1];
- for(int i=0;i<=strlen(ime);i++)
- name[i]=ime[i];
- char prezime[20];
- cout<<"Input name2:"<<endl;
- cin>>prezime;
- second_name=new char[strlen(prezime)+1];
- for(int i=0;i<=strlen(prezime);i++)
- second_name[i]=prezime[i];
- char familiq [20];
- cout<<"Input name3:"<<endl;
- cin>>familiq;
- family_name=new char[strlen(familiq)+1];
- for(int i=0;i<=strlen(familiq);i++)
- family_name[i]=familiq[i];
- char egn [20];
- cout<<"Input egn:"<<endl;
- cin>>egn;
- }
- void Output();
- ~Persona() {
- delete[] name;
- delete[] second_name;
- delete[] family_name;
- }
- };
- class Student:public Persona
- {
- private:
- double fak_nomer;
- char*spec;
- double sr_uspeh;
- public:
- void Input();
- void Output();
- ~Student() {delete[]spec;}
- };
- int main()
- {
- Persona a;
- a.Input();
- int item[100];
- int a, b, t;
- int count;
- /*Прочитане на числата*/
- cout<<"how many numbers?";
- cin>>count;
- for(a=0; a<count; a++) cout<<item[a];
- /*Сортиране чрез метода на мехурчето*/
- for(a=0; a<count; ++a)
- for(b=count-1; b>a; --b){
- /*Сравняване на съседни елементи*/
- if(item[b-1] > item[b]){
- t = item[b-1];
- item[b-1] = item[b];
- item[b] = t;
- }
- }
- /*Изписване на числата*/
- for(t=0; t<count; t++) cout<<"Chisloto e:"<< item[t]);
- bool swapped = true;
- int j = 0;
- int tmp;
- while (swapped) {
- swapped = false;
- j++;
- for (int i = 0; i < n - j; i++) {
- if (arr[i] > arr[i + 1]) {
- tmp = arr[i];
- arr[i] = arr[i + 1];
- arr[i + 1] = tmp;
- swapped = true;
- }
- }
- }
- for (int i = 0; i<5; i++)
- cout << array[i].getN() << "\t";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement