Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. class Student{
  6.     int an,medie;
  7.     string nume;
  8. public:void setNume(string);
  9.        void showNume();
  10. };
  11.  
  12. void Student::setNume(string nume) {
  13.     Student::nume = nume;
  14. }
  15.  
  16. void Student::showNume() {
  17.     cout << nume;
  18. }
  19. int main()
  20. {
  21.     Student stud[1];
  22.     string as;
  23.     for (int i = 0; i < 2; i++) {
  24.         cout << "Introduceti numele pentru studentul " << i << " : ";
  25.         cin >> as;
  26.         stud[i].setNume(as);
  27.     }
  28.     //system("pause");
  29.     return 0;
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement