Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <stdio.h>
- #include <stdlib.h>
- using namespace std;
- typedef struct
- {
- char nume[100];
- float med, val;
- } STUD;
- int main()
- {
- STUD s[100];
- int n = 0, x;
- do
- {
- cout << "1 - ADAUGA STUDENT" << endl;
- cout << "2 - listare studenti" << endl;
- cout << "3 - cautare student" << endl;
- cout << "4 - exit:" << endl;
- cout << "alege o optiune:" << endl;
- cin >> x;
- getchar();
- switch (x)
- {
- case 1:
- STUD st;
- cout << "introdu datele (nume-medie-valoare bursa):" << endl;
- gets(st.nume);
- cin >> st.med >> st.val;
- s[n++] = st;
- break;
- case 2:
- cout << "Lista studenti:" << endl;
- for (int i = 0; i < n; i++)
- cout << s[i].nume << ' ' << s[i].med << ' ' << s[i].val << endl;
- break;
- case 3:
- cout << "nume student:" << endl;
- char nume[100];
- gets(nume);
- for (int i = 0, f = i; i < n && !f; i++)
- if (!strcmp(s[i].nume, nume))
- {
- cout << s[i].med << ' ' << s[i].val << endl;
- f = 1;
- }
- break;
- case 4:
- break;
- default:
- cout << "optiune inexistenta!" << endl;
- }
- }
- while (x != 4);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement