Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <iomanip>
- using namespace std;
- const int N=2;
- string fam="Dimitrov";
- int sum=0;
- struct student
- {
- string name;
- string familyName;
- string facN;
- string group;
- };
- typedef student Tmasstud[N+1];
- Tmasstud masstud;
- void instud(student &a)
- {
- cout<<"Name: ";
- cin>>a.name;
- cout<<"Family name: ";
- cin>>a.familyName;
- cout<<"F number: ";
- cin>>a.facN;
- cout<<"Group: ";
- cin>>a.group;
- }
- void outstud(student a)
- {
- cout<<a.name<<" ";
- cout<<a.familyName<<" ";
- cout<<a.facN<<" ";
- cout<<a.group<<endl;
- }
- void input(Tmasstud a, int n)
- {
- for(int i=1;i<=n;i++)
- {
- cout<<"Enter data for "<<i<<"student"<<endl;
- instud(a[i]);
- }
- }
- void antetka()
- {cout<<" Name"<<" "<<" Family name"<<" "<<" F number "<<" "<<" Group"<<endl;}
- void output(Tmasstud a, int n)
- {
- antetka();
- for(int i=1;i<=n;i++)
- {
- outstud(a[i]);
- }
- }
- int strcom(student a)
- {
- if(a.familyName.compare(fam)==0)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- void strcompare(Tmasstud a, int n)
- {
- for(int i=0;i<n;i++)
- {
- sum+=strcom(a[i]);
- }
- double perc=(sum/N)*100;
- cout<<perc;
- }
- int main()
- {
- input(masstud,N);
- output(masstud,N);
- strcompare(masstud,N);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement