Daria

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

/******************************************************************************

punct in plan

*******************************************************************************/

#include <iostream>

using namespace std;

struct punct

int x, y;

};

punct A, B, M;

int main()

cin>>A.x>>A.y;

cin>>B.x>>B.y;

cout<<"A("<<A.x<<","<<A.y<<")"<<endl;

cout<<"B("<<B.x<<","<<B.y<<")"<<endl;

if(A.x<0 && A.y<0)

cout<<"Da";

else cout<<"Nu";

M.x=(A.x+B.x)/2;

M.y=(A.y+B.y)/2;

cout<<endl;

cout<<"M("<<M.x<<","<<M.y<<")"<<endl;

return 0;

/******************************************************************************
vectori de struct

*******************************************************************************/

#include <iostream>

using namespace std;

struct elev

char nume[20], liceu[20];

float nota;

}p[50];

int main()

int n,maxn,k, i;

float media, s=0;

cin>>n;

for(i=1;i<=n;i++)

cin>>p[i].nume>>p[i].liceu>>p[i].nota;

maxn=p[1].nota;

s=s+p[1].nota;

for(i=2;i<=n;i++)

if(p[i].nota>maxn)

k=i;

maxn=p[i].nota;

s=s+p[i].nota;

}
cout<<p[k].nume<<endl;

cout<<s/n;

return 0;

You might also like