Different methods of initializing the array


1)a) What do you mean by const keyword? Demonstrate with help of suitable example

b) Given the following code fragment:

int ch = 20;
cout << ch << ++ ch << ch << “\n”;

(i) The output of code fragment.

(ii) What is the effect of replacing ++ ch with ch + 1?

2) In the following program, if value of N given by user is 20, what maximum and minimum value the program could probably show?

#include
#include
void main()
{
int N, Guessme;
randomize();
cin>>N;
Guessme = random(N-10) + 10 ;
cout<}

3) Write down the name of the header files that is needed to perform the following program segment

void main()
{
int n;
cout<<"Enter a number";
cin>>n;
if(n==0)
exit(0);
cout<<"Square of n is "<}

4)a) What do you understand by an Array? How does it differ from normal variable? What are the different methods of initializing the array? With suitable example, show how to input and output elements in an array. Design block diagrams wherever needed

b) Write a program to interchange elements of a given array as given below

A = 10 13 24 65 17 38 19 after change it must be

A = 13 10 65 24 38 17 19

(adjacent element interchange , if odd numbers last element remains unchanged)

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Different methods of initializing the array
Reference No:- TGS010502

Expected delivery within 24 Hours