100 to 150 words no plagiarism i What is the difference betw
100 to 150 words, no plagiarism.
(i) What is the difference between = and = operators.
(ii) What is abstraction implemented in C++?
(iii) Rita is writing a C++ program in which, she wants to display the grades (stored in variable grade) as per the table of marks (stored in variable marks) given below:
A – 90-100
B – 80-89
C – 70-79
D < 70
Write the code using appropriate C++ conditional statement so as to help Rita complete her work after accepting marks.
Solution
i) Answer:
There are two operators :
== and =
= is a operator is used to assign the value in the variable in C or C++ language
For example :-
c = a + b ;
It means after adding the values of \"a\" and \"b\" , the result is assigned in the variable \"c\" . Thus the operator \"=\" is used to assign the value in the variable , or we can say that after the operation on the values of the variables , the result is stored in the variable like \"c\" .
Now we have a = 2;
It means value 2 is assigned in the variable a.
\"==\" on the other hand is an operator used to check the equality between the two variables . For example :-
if( a==b)
{
a = 3;
}
it means if a and b are equal then assign the value 3 in the variable a.
iii) Answer :
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int marks;
cout<<\"Enter marks:=\";
cin>>marks;
if((marks>90)&&(marks<=100))
{
cout<<\"A grade\";
}
else
if((marks>80)&&(marks<=89))
{
cout<<\"B grade\";
}
else
if((marks>70)&&(marks<=79))
{
cout<<\"C grade\";
}
else
if(marks<70)
{
cout<<\"D grade\";
}
getch();
}

