Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Mail
  5. {
  6.     char sender[50];
  7.     int date;
  8.     char text[200];
  9.     int risk;
  10. };
  11.  
  12. struct Inbox
  13. {
  14.     char destination[100];
  15.     int nmails;
  16.     Mail x[200];
  17. };
  18.  
  19. void main()
  20. {
  21.     Inbox y[20];
  22.     for (int i = 0; i < 20; i++)
  23.     {
  24.         cout << "Enter the destination:" << endl;
  25.         gets_s(y[i].destination);
  26.         cout << "Enter the number of mails:" << endl;
  27.         cin >> y[i].nmails;
  28.         for (int j = 0; j < y[i].nmails; j++)
  29.         {
  30.             cout << "Enter the sender name:" << endl;
  31.             gets_s(y[i].x[j].sender);
  32.             cout << "Enter the text:" << endl;
  33.             gets_s(y[i].x[j].text);
  34.             cout << "Enter the date:" << endl;
  35.             cin >> y[i].x[j].date;
  36.             cout << "Enter the risk of virus attachment with the mail:" << endl;
  37.             cin >> y[i].x[j].risk;
  38.         }
  39.     }
  40.     int range1, range2;
  41.     cout << "Enter a range of risk:" << endl;
  42.     cin >> range1 >> range2;
  43.     for (int i = 0; i < 20; i++)
  44.     {
  45.         for (int j = 0; j < y[i].nmails; j++)
  46.         {
  47.             if (y[i].x[j].risk >= range1 && y[i].x[j].risk <= range2)
  48.             {
  49.                 cout << y[i].x[j].text;
  50.             }
  51.         }
  52.     }
  53.     system("pause");
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement