Advertisement
Sher123

header file

Sep 22nd, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #ifndef SYSTEMCALL_H
  5. #define SYSTEMCALL_H
  6.  
  7. using namespace std;
  8.  
  9. class SystemCall
  10. {
  11.  
  12. public:
  13. SystemCall();
  14. int cache1[5];
  15. int cache2[10];
  16. int ram[20];
  17. int figure;
  18.  
  19.  
  20.  
  21. int number;
  22.  
  23.  
  24.  
  25.  
  26. void RandomNumbers(int numbers[], int length)
  27. {
  28.  
  29. for(int i = 0; i < length; i++ )
  30. {
  31.  
  32. numbers[i] = rand()%20 + 1;
  33. cout<<numbers[i]<<"\t";
  34.  
  35. }
  36.  
  37. }
  38. void RequestInput(int number)
  39. {
  40. cout<<"Type a number between 1 to 20"<<endl;
  41. cin>>number;
  42. figure = number;
  43.  
  44.  
  45. searchNumber(figure);
  46. }
  47. void searchNumber(int figure)
  48. {
  49. if(figure > 0 && figure < 21)
  50. {
  51.  
  52. for(int i = 0; i < 20; i++)
  53. {
  54. if(figure == cache1[i]){
  55.  
  56. cout<<"The number was found in the first cache"<<endl;
  57. break;
  58.  
  59. }
  60. else if(figure == cache2[i])
  61. {
  62.  
  63. cout<<"The number was found in the second cache"<<endl;
  64. break;
  65. }
  66. else if(figure == ram[i])
  67. {
  68.  
  69. cout<<"The number was found in the RAM"<<endl;
  70. break;
  71. }
  72. else{
  73. cout<<"The number could not be found"<<endl;
  74. break;
  75. }
  76.  
  77.  
  78. }
  79.  
  80. }
  81. else
  82. {
  83.  
  84. cout<<"Wrong input"<<endl;
  85. }
  86.  
  87. }
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. };
  96.  
  97. #endif // SYSTEMCALL_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement