Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct student{
- string ime;
- string prezime;
- int brojnaindex;
- double prosek;
- };
- int main()
- {
- int N;
- cin>>N;
- student niza[N];
- for(int i=0; i<N; i+=1){
- cin>>niza[i].ime;
- cin>>niza[i].prezime;
- cin>>niza[i].brojnaindex;
- cin>>niza[i].prosek;
- }
- for(int p=0; p<N; p+=1){
- for(int y=p+1; y<N; y+=1){
- if(niza[p].brojnaindex>niza[y].brojnaindex){
- swap(niza[p],niza[y]);
- }
- }
- }
- cout << endl;
- for(int u=0; u<N; u+=1){
- cout<<niza[u].ime << " " ;
- cout<<niza[u].prezime << " ";
- cout<<niza[u].brojnaindex << " " ;
- cout<<niza[u].prosek << " ";
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment