Hellko

Untitled

Mar 10th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. struct pasport {
  6. char fio[100];
  7. int age;
  8. };
  9.  
  10. void print(pasport C) {
  11. cout<<"FIO: "<<C.fio<<" Age: "<<C.age<<"\n";
  12. }
  13.  
  14. pasport read(void) {
  15. pasport A;
  16. cout<<"Vvedite vozrast: ";
  17. cin>>A.age;
  18. cin.ignore();
  19. cout<<"Vvedite FIO: ";
  20. cin.getline(A.fio,sizeof(A.fio));
  21. return A;
  22. }
  23.  
  24. int main() {
  25. /* pasport A;
  26. cout<<"Vvedite vozrast: ";
  27. cin>>A.age;
  28. cin.ignore();
  29. cout<<"Vvedite FIO: ";
  30. cin.getline(A.fio,sizeof(A.fio));
  31. print(A);
  32. */
  33. pasport *A;
  34. int count;
  35. cout<<"Vvedite kol-vo zhiteley: ";
  36. cin>>count;
  37. A = new pasport[count];
  38. for(int i=0; i<count; i++) {
  39. A[i]=read();
  40. }
  41.  
  42. for(int i=0; i<count; i++) {
  43. print(A[count-i-1]);
  44. }
  45.  
  46.  
  47.  
  48.  
  49. /* int a,b,c;
  50. cin>>a>>b>>c;
  51. cout.fill('.');
  52. cout<<a<<setw(5)<<b<<setw(5)<<c<<"\n";
  53. float d;
  54. cin>>d;
  55. cout.precision(a);
  56. cout<<d<<"\n";
  57. char f[40];
  58. cin.ignore();
  59. cin.getline(f,sizeof(f));
  60. cout<<f;
  61. */
  62. /*
  63. int i;
  64. for(i=1;i<10;i++) {
  65. cout<<setw(3)<<i;
  66. if(i%3==0) cout<<"\n";
  67. }
  68. */
  69. /*
  70. int i;
  71. cin>>i;
  72. char *c, temp;
  73. c = new char[i+1];
  74. cout<<"vvedite str: ";
  75. cin.ignore();
  76. cin.getline(c,i+1);
  77.  
  78. for(int j=0;j<i/2;j++) {
  79. temp=c[i-1-j];
  80. c[i-1-j]=c[j];
  81. c[j]=temp;
  82. }
  83. cout<<c;
  84. */
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment