wklejamy.pl website for sale. You are interested in. Please contact. wklejamy@gmail.com
Click to buy coffe
Untitled
Guest 102 9th Jun, 2023
#include <iostream>
#include <cstring>
#define ROZ 5
using namespace std;
struct Student
{
char imie[20];
char nazwisko[20];
int wiek;
float srednia;
long int indeks;
};
void wczytajdane(Student * arg)
{
cout << "imie";
cin >> arg->imie;
cout << "nazwisko";
cin >> arg->nazwisko;
cout << "wiek";
cin >> arg->wiek;
cout << "srednia";
cin >> arg->srednia;
cout << "indeks";
cin >> arg->indeks;
}
void wypiszTablice(Student * arg)
{
cout << "Dane Studenta";
cout << arg->imie << endl;
cout << arg->nazwisko << endl;
cout << arg->wiek << endl;
cout << arg->srednia << endl;
cout << arg->indeks << endl;
}
void srednia(Student *arg){
int suma=0;
for(int i=0; i < ROZ; i++){
suma=suma + arg[i].srednia;
}
cout << suma/ROZ;
}
int main(void){
Student Stud[ROZ];
int wybierz,indeks;
while(true){
cout<<"wybierz opcje (1 dodaj, 2 wypisz, 3 - policz srednia)";
cin>>wybierz;
switch(wybierz){
case 1:
cout<<"podaj numer wpisywanego studenta";
cin>>indeks;
if(indeks<=ROZ && indeks>0)
wczytajdane(&Stud[indeks-1]);
break;
case 2:
cout<<"podaj numer wpisywanego studenta";
cin>>indeks;
if(indeks<=ROZ && indeks>0)
wypiszTablice(&Stud[indeks-1]);
break;
case 3:
srednia(Stud);
break;
default:
return 0;
}
}
}
To share this paste please copy this url and send to your friends
RAW Paste Data