Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #ifndef SYSTEMCALL_H
- #define SYSTEMCALL_H
- using namespace std;
- class SystemCall
- {
- public:
- SystemCall();
- int cache1[5];
- int cache2[10];
- int ram[20];
- int figure;
- int number;
- void RandomNumbers(int numbers[], int length)
- {
- for(int i = 0; i < length; i++ )
- {
- numbers[i] = rand()%20 + 1;
- cout<<numbers[i]<<"\t";
- }
- }
- void RequestInput(int number)
- {
- cout<<"Type a number between 1 to 20"<<endl;
- cin>>number;
- figure = number;
- searchNumber(figure);
- }
- void searchNumber(int figure)
- {
- if(figure > 0 && figure < 21)
- {
- for(int i = 0; i < 20; i++)
- {
- if(figure == cache1[i]){
- cout<<"The number was found in the first cache"<<endl;
- break;
- }
- else if(figure == cache2[i])
- {
- cout<<"The number was found in the second cache"<<endl;
- break;
- }
- else if(figure == ram[i])
- {
- cout<<"The number was found in the RAM"<<endl;
- break;
- }
- else{
- cout<<"The number could not be found"<<endl;
- break;
- }
- }
- }
- else
- {
- cout<<"Wrong input"<<endl;
- }
- }
- };
- #endif // SYSTEMCALL_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement