Explanation:
Hardware is useless without software because the machinery will not and cannot do anything without programming to tell it what to do. Without an operating system, the computer can't do anything. Without other software, like Microsoft Office, you can't type anything or listen to music or watch video or anything
Do I suppose to answer a question please let me know
Answer:
Encapsulation:-It is the binding of the data and functions so that they works as one unit.
Inheritance:-When one class acquires the property of another class it is called inheritance.
Polymorphism :-It generally means more than one form
Explanation:
Encapsulation:- class is an example of encapsulation it can hold different data types and functions in a single container called class.
class Name{
public:
string first_name;
string last_name;
void Display()
{
cout<<first_name<<" "<<last_name<<endl;
}
};
Inheritance:-The property of a class acquiring the properties of another class is called inheritance.
Now we will inherit the above defined class.
class person: public Name
{
public:
char gender;
int age;
void Display()
{
cout<<first_name<<" "<<last_name<<gender<<age<<endl;
}
};
int main()
{
Name n;
person p;
n.Display();
p.Display();
}
Polymorphism- There are two types of polymorphism:-
1.Run time polymorphism=The values are decided at run time.
2.Compile time polymorphism=The values are decided at compile time.
Example:-In the above example we have function Display() in both the classes.This is an example of compile-time polymorphism. We are deciding at the time of compilation which display to use.
Complete Question:
Assume that an array of Integers named a that contains exactly five elements has been declared and initialized. In addition, an int variable j has also been declared and initialized to a value somewhere between 0 and 3.
Write a single statement that assigns a new value to the element of the array indexed by j. This new value should be equal to twice the value stored in the next element of the array (i.e. the element after the element indexed by j ). Do not modify any other elements of the array!
Answer:
a[j] = 2 * a[j+1];
Explanation:
Since the array is named a and its indexes are referenced by the variable j
it means the elements of the array will be a[j] for (j=0; j=1;j=2).
The first element in the array (j=0) will be a[0], second element will be a[1] and so on.
The statement a[j] = 2 * a[j+1]; assigns a new value to the element of the array indexed by j, the value is equal to twice the value stored in the next element of the array (j+1).