Answer:
... not unlike cancer.
Explanation:
so we have a double negative so it makes it a positive, so that would basically mean like cancer
so false i think
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:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int minn=INT_MAX;
int maxx=INT_MIN;
int n1,n2,n3,n4,n5;
cout<<"enter five Numbers:";
//read 5 Numbers
cin>>n1>>n2>>n3>>n4>>n5;
// find maximum
if(n1>maxx)
maxx=n1;
if(n2>maxx)
maxx=n2;
if(n3>maxx)
maxx=n3;
if(n4>maxx)
maxx=n4;
if(n5>maxx)
maxx=n5;
// find minimum
if(n1<minn)
minn=n1;
if(n2<minn)
minn=n2;
if(n3<minn)
minn=n3;
if(n4<minn)
minn=n4;
if(n5<minn)
minn=n5;
// print maximum and minimum
cout<<"maximum of five numbers is: "<<maxx<<endl;
cout<<"minimum of five numbers is: "<<minn<<endl;
return 0;
}
Explanation:
Declare two variables "minn" & "maxx" and initialize them with INT_MAX and INT_MIN respectively.Then read the five number from user and compare it with "minn" & "maxx" ,if input is greater than "maxx" then update "maxx" or if input is less than "minn" then update the "minn". After all the inputs, "minn" will have smallest and "maxx" will have largest value.
enter five Numbers:5 78 43 55 12
maximum of five numbers is: 78
minimum of five numbers is: 5