Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- struct elev
- {
- char nume[256],prenume[256];
- int ma,t;
- };
- int main()
- {
- int n,aux;
- float m[100];
- cout<<"n=";cin>>n;
- cin.get();
- elev v[100];
- for(int i=0;i<n;i++)
- {
- cout<<"Nume="; cin>>v[i].nume;
- cout<<"Prenume="; cin>>v[i].prenume;
- cout<<"Media="; cin>>v[i].ma;
- cout<<"Teza=";cin>>v[i].t;
- m[i]=(float(v[i].ma*3.00)+v[i].t)/4;
- m[i]=int(m[i]*100);
- m[i]=float(m[i]/100);
- }
- for(int i=0;i<n;i++)
- if(m[i]>=5.00)
- cout<<v[i].nume<<" "<<v[i].prenume<<" a promovat"<<endl;
- else
- cout<<v[i].nume<<" "<<v[i].prenume<<" nu a promovat"<<endl;
- for(int i=0;i<n-1;i++)
- {
- for(int j=i+1;j<n;j++)
- {
- if(m[i]<m[j])
- {
- aux=m[i];
- m[i]=m[j];
- m[j]=aux;
- }
- }
- }
- cout<<"Media elevilor descrescator=";
- for(int i=0;i<n;i++)
- cout<<float(m[i])<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement