Answer:
Check the explanation
Explanation:
bool oneSale(string item){
for(int i=0;i<capacity;i++){ // iterate till the capcity of array
if(item==grocerryList[i].name()){ // if name matches
if(grocerryList[i].getStock()>0){ // and stock is greater than 0
grocerryList[i].setStock(grocerryList[i].getStock()-1); // subtract 1 from the stock
// or alternate is grocerryList[i].stock= grocerryList[i].stock-1;
return true; // return true
}
}
else if(item==grocerryList[i].name()){ // if name matches
if(grocerryList.getStock()==0){ // but stock is empty
return false; // return falsse
}
}
else{ // means item is not available so there is no need to check stock
return false; // return false
}
}
}
Answer:
// code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int n;
cout<<"Enter a positive number:";
// read number
cin>>n;
// check number is positive or not
while(n<0)
{
// if number is negative
cout<<"Wrong input!!"<<endl;
// ask again to enter again
cout<<"Enter again:";
// read number again
cin>>n;
}
// generate random number between 1 to n
int ran=rand()%n +1;
// print random number
cout<<"Random number between 1 to "<<n<<" is: "<<ran<<endl;
return 0;
}
Explanation:
Read a number from user.Then if input number is negative then ask user to enter a positive number again.After this generate a random number between 1 to n.Print that random number.
Output:
Enter a positive number:-12
Wrong input!!
Enter again:9
Random number between 1 to 9 is: 2
Answer:
code = 010100000001101000101
Explanation:
Steps:
The inequality yields
, where M = 16. Therefore,
The second step will be to arrange the data bits and check the bits. This will be as follows:
Bit position number Check bits Data Bits
21 10101
20 10100
The bits are checked up to bit position 1
Thus, the code is 010100000001101000101
Answer:
a. An open source port scanning and host detection utility. In a penetration test, this consists of penetration testers who have been given some background knowledge of the infrastructure.
Explanation:
b. Red team is special for checking to penetration test and there is no defend
c. They are not aware that penetration test is happening
d. The process is to check system security infrastructure by trying different types of penetration in unexpected ways.
a. <em>There is a special team created as called Red Team that they try to penetrate to the system with different methods. This test is longer and different then normal tests to detect is a system giving an alert for any action damaging to the system.</em>