Answer:
#include <iostream>
using namespace std;
int * reverse(int a[],int n)//function to reverse the array.
{
int i;
for(i=0;i<n/2;i++)
{
int temp=a[i];
a[i]=a[n-i-1];
a[n-i-1]=temp;
}
return a;//return pointer to the array.
}
int main() {
int array[50],* arr,N;//declaring three variables.
cin>>N;//taking input of size..
if(N>50||N<0)//if size greater than 50 or less than 0 then terminating the program..
return 0;
for(int i=0;i<N;i++)
{
cin>>array[i];//prompting array elements..
}
arr=reverse(array,N);//function call.
for(int i=0;i<N;i++)
cout<<arr[i]<<endl;//printing reversed array..
cout<<endl;
return 0;
}
Output:-
5
4 5 6 7 8
8
7
6
5
4
Explanation:
I have created a function reverse which reverses the array and returns pointer to an array.I have also considered edge cases where the function terminates if the value of the N(size) is greater than 50 or less than 0.
Answer:
You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.
Explanation:
Your input may have to be different then output varying on what data you are processing.
For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.
Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.
Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.
Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:
<u>Code (Python)</u>
def IsSmart(gpa):
if (gpa >= 4):
return True
else
return False
As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.
Answer:
Option A.
Explanation:
Incorrect subnet is the most likely problem in this scenario.
Answer:
b) A seemingly tempting, but bogus target meant to attract (and distract) hacking attempts.
Explanation:
The name is pretty self explanatory.