Advertisement
alkelane7

Struct 2

Mar 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. Ahmed Sami:
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. struct mailing{
  7.  
  8. string name [2];
  9. int zip[2];
  10. char state[3][3];
  11. string address1[2],address2[2];
  12.  
  13.  
  14.  
  15. };
  16.  
  17. void info(){
  18.  
  19. struct mailing m;
  20.  
  21. for(int i=0;i<2;i++){
  22.  
  23. int j =0;
  24. int k =1;
  25. cout<<"Enter your name : ";
  26. cin>>m.name[i];
  27.  
  28. cout<<"\n Entre your zipcode of your city : ";
  29. cin>>m.zip[i];
  30.  
  31. cout<<"\n Entre first address : ";
  32. cin>>m.address1[i];
  33.  
  34. cout<<"\nEntre second address : ";
  35. cin>>m.address2[i];
  36.  
  37.  
  38.  
  39. cout<<"\nEntre state two litters only : ";
  40. cin>>m.state[i][j];
  41. cin>>m.state[i][k];
  42. ++j;
  43. ++k;
  44.  
  45. }
  46.  
  47. for(int l=0;l<2;l++){
  48.  
  49. int j =0;
  50. int k =1;
  51. cout<<"NAME : ";
  52. cout<<m.name[l];
  53.  
  54. cout<<"\nZIPCODE : ";
  55. cout<<m.zip[l];
  56.  
  57. cout<<"\n FIRST ADDRESS : ";
  58. cout<<m.address1[l];
  59.  
  60. cout<<"\nSECOND ADDRESS : ";
  61. cout<<m.address2[l];
  62.  
  63.  
  64.  
  65. cout<<"\n STATE : ";
  66. cout<<m.state[l][j];
  67. cout<<m.state[l][k];
  68. ++j;
  69. ++k;
  70. }
  71.  
  72.  
  73.  
  74.  
  75.  
  76. }
  77.  
  78. int main()
  79. {
  80.  
  81. info();
  82.  
  83.  
  84.  
  85.  
  86. return 0;
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement