Advertisement
rosyidi

rusak

Jun 30th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <iostream>
  2. #define Nmaks 100
  3. using namespace std;
  4.  
  5. typedef struct{
  6. string NIM;
  7. string NamaMhs;
  8. float IPK;
  9. }Mahasiswa;
  10.  
  11. typedef Mahasiswa TabMhs[Nmaks];
  12.  
  13. void BanyakData(int &n);
  14. void BacaLarik(int n, TabMhs A);
  15. void TampilkanHasil(int n, TabMhs A);
  16.  
  17. int main()
  18. {
  19. int N;
  20. TabMhs Array;
  21. BanyakData(N);
  22. BacaLarik(N, Array);
  23. TampilkanHasil(N, Array);
  24. return 0;
  25. }
  26.  
  27. void BanyakData(int &n)
  28. {
  29. cout<<"Banyak data = ";
  30. cin>>n;
  31. }
  32.  
  33. void BacaLarik(int n, TabMhs A)
  34. {
  35. int i;
  36. for(i=1; i<=n; i++)
  37. {
  38. cout<<"NIM : ";
  39. cin>>A[i].NIM;
  40. cout<<"Nama : ";
  41. getline(cin, A[i].NamaMhs);
  42. cout<<"IPK : ";
  43. cin>>A[i].IPK;
  44. cout<<"\n";
  45. }
  46. }
  47.  
  48. void TampilkanHasil(int n, TabMhs A)
  49. {
  50. int i;
  51. for(i=1; i<=n; i++)
  52. {
  53. cout<<"NIM : "<<A[i].NIM<<"\n";
  54. cout<<"Nama : "<<A[i].NamaMhs<<"\n";
  55. cout<<"IPK : "<<A[i].IPK<<"\n";
  56. cout<<"\n";
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement