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:
add the following code to your bar class
Explanation:
public Bar(Commands n) { }
Answer:
I think he may be a nut, but I'm not sure, there's little evidence of what he says to be true.
Answer:
1. Open Shortest Path First (OSPF)
2. Border Gateway Protocol (BGP)
3. Routing and Remote Access Service (RRAS)
4. Frame relay
5. Synchronous
6. Virtual
7. Committed Information Rate (CIR)
8. Integrated Services Digital Network (ISDN)
9. Asynchronous Transfer Mode (ATM)
10. Basic Rate Interface (BRI).
Answer:
// program in java.
// package
import java.util.*;
// class definition
class Main
{// main method of the class
public static void main (String[] args) throws java.lang.Exception
{
try{
// scanner object to read inputs
Scanner scr=new Scanner(System.in);
// variables
String name;
double price;
System.out.print("Enter item's name: ");
// read item's name
name = scr.next();
System.out.print("Enter item's price: ");
// read item's price
price= scr.nextDouble();
// print name
System.out.println("name of item is:"+name);
// print price
System.out.println("price of item is:"+price);
}catch(Exception ex){
return;}
}
}
Explanation:
Read name & price of item from user and assign it to variables "name" & "price" respectively with scanner object.Then print the name and price of item .
Output:
Enter item's name: Apple
Enter item's price: 100
name of item is:Apple
price of item is:100.0