Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- struct date
- {
- char nume[256], prenume[256];
- float media, teza;
- };
- int main()
- {
- int n;
- cout<<"n=";
- cin>>n;
- cin.get();
- date v[100], aux;
- for(int i=0; i<n; i++)
- {
- cout<<"Nume: ";
- cin.get(v[i].nume, 255);
- cin.get();
- cout<<"Prenume: ";
- cin.get(v[i].prenume, 255);
- cin.get();
- cout<<"media: ";
- cin>>v[i].media;
- cin.get();
- cout<<"teza: ";
- cin>>v[i].teza;
- cin.get();
- cout<<endl;
- }
- for(int i=0; i<n-1; i++)
- for(int j=i; j<n; j++)
- if(strcmp(v[i].nume, v[j].nume)==1 ||
- strcmp(v[i].nume, v[j].nume)==0 &&
- strcmp(v[i].prenume, v[j].prenume)==1
- )
- {
- aux=v[i];
- v[i]=v[j];
- v[j]=aux;
- }
- for(int i=0; i<n; i++)
- if((v[i].media*3+v[i].teza)/4<5)
- cout<<v[i].nume <<" "<<v[i].prenume<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement