Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<fstream>
- using namespace std;
- typedef struct {
- char nume[30];
- char an;
- int grupa;
- char nrd;
- char note[15];
- }STUDENT;
- void main()
- {
- ofstream f;
- STUDENT x;
- char nume_f[20];
- int i;
- cout << "\Nume fisier:";
- cin >> nume_f;
- f.open(nume_f);
- if (!f)
- cout << "\nFisierul " << nume_f << " nu poate fi deschis";
- else
- {
- //citire articol
- cout << "\nNume: ";
- cin >> x.nume;
- cout << "An: ";
- cin >> x.an;
- cout << "Grupa: ";
- cin >> x.grupa;
- cout << "Numar discipline: ";
- cin >> x.nrd;
- for (i = 0; i < (int)x.nrd-48; i++)
- {
- cout << "\nNota " << i << " = ";
- cin >> x.note[i];
- }
- //adaugare articol citit de la tastatura
- f << x.nume << " " << x.an << " " << x.grupa << " " << x.nrd << " ";
- for (i = 0; i < (int)x.nrd-48; i++)
- f << x.note[i]<<" ";
- f.close();
- }
- cout << "\nAdaugarea s-a terminat";
- cout << "\nApasa o tasta";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement