0% found this document useful (0 votes)
64 views3 pages

Gaitur Alexandr Claxi-Ac

The document is a C++ program that analyzes data about students in a class. It takes in the number of students and collects their names, surnames, sexes, and heights. It then outputs tables with the class roster, average heights by sex, and identifies the tallest male student. It also checks if any two students have the same height. The program uses structures to store student data and loops to input, output, and analyze the information.

Uploaded by

sura1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views3 pages

Gaitur Alexandr Claxi-Ac

The document is a C++ program that analyzes data about students in a class. It takes in the number of students and collects their names, surnames, sexes, and heights. It then outputs tables with the class roster, average heights by sex, and identifies the tallest male student. It also checks if any two students have the same height. The program uses structures to store student data and loops to input, output, and analyze the information.

Uploaded by

sura1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Gaitur Alexandr

Cl a XI-a C

Ex. 4 a,b,c pg. 52


#include <iostream>
#include<iomanip>
using namespace std;

int main()
{struct Record
{char Nume[20];
char Prenume[30];
char Sex;
float Inaltime;
};
Record R;
typedef Record ListaElevi[50];
ListaElevi LE;

int n, i, j, k, p, l, a, b, g;
float sn, medf, medm, PlataLunara, smax ;

cout << "Da numarul de elevi n="; cin >> n;


k=0; l=0; a=0; b=0; g=0;
for (i = 0; i < n; i++)
{cout << "Numele: ";cin >> LE[i].Nume;
cout << "Prenumele: ";cin >> LE[i].Prenume;
cout << "Sex: ";cin >> LE[i].Sex;
cout << "Inaltimea: ";cin >> LE[i].Inaltime;
};
Gaitur Alexandr
Cl a XI-a C

cout << "______________________________________________________________" << endl;


cout << " Tabelul clasei de elevi " << endl;
cout << "______________________________________________________________" << endl;
cout << "Nr. : Numele : Prenumele : Sex : Inaltimea " << endl;
cout << "______________________________________________________________" << endl;
for (i = 0; i < n; i++)
{

cout.setf(ios::fixed);cout.setf(ios::showpoint);cout.precision(2);
cout <<setw(3);
cout<<i+1<<setw(10)<<LE[i].Nume <<setw(14)<< LE[i].Prenume <<setw(10)<<
LE[i].Sex<<setw(12)<<LE[i].Inaltime<<endl;
if (LE[i].Sex=='F') {k=k+LE[i].Inaltime; a=a+1;}
if (LE[i].Sex=='M') {l=l+LE[i].Inaltime; b=b+1;}
}
medf=k/a;
medm=l/b;
cout << "________________________________________________________________" <<
endl;
cout << "Inaltimea medie a persoanelor de sex feminin: "<<medf<<endl;
cout << "________________________________________________________________" <<
endl;
cout << "Inaltimea medie a persoanelor de sex masculin: "<<medm<<endl;
cout << "________________________________________________________________" <<
endl;
cout << "Cea mai inalta persoana de sex masculin: "<< endl;
cout << "________________________________________________________________" <<
endl;
cout << " Numele : Prenumele : Inaltime "<<endl;
for (i = 0; i < n; i++)
Gaitur Alexandr
Cl a XI-a C

if (R.Inaltime<LE[i].Inaltime) R=LE[i];
cout <<setw(10) <<R.Nume <<setw(12)<< R.Prenume <<setw(15)<< R.Inaltime << endl;
cout << "_________________________________________________________________"
<<endl;
cout<<"In grupa sunt cel putin doua persoane de aceeasi inaltime: ";
for (i=0; i < n; i++)
for (j=0; j<n; j++)
if (LE[i].Inaltime==LE[j].Inaltime && i!=j) {g=g+1;}
if (g>1) cout<<"TRUE";
else cout<<"FALSE";

return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy