Posts

Showing posts from April, 2020

If-else statement in c++

Image
If statement syntax    If the condition is true it's body execute otherwise dose not execute. In the case of if in the place of condition always zero and non zero condition is cheked in which zero means condition is false and non zero means condition is true. Example #include<iostream.h> #include<conio.h> int main () { //Assigning value to the variable int x =50 ,y =20 ; //checking the condition if (x > y) { cout<< "x is greater than y" ; } } ### Output ### x is greater than y If-else statement:- syntax Example #include<iostream.h> int main () { //Assigning value to the variable int x =50 ,y =20 ; //checking the condition if (x == y) { cout<< "x is equal to y" ; } else { cout<< "x is not equal to y" ; } } ### Output ### //In the above program condition is false because the value of x=50 and the value of y=20 and they are not equal so else part will execute. x is not eq...

Operators of c++

Image
Operator It is a special symbol which is used to perform logical or mathematical operation on data or variable. Operand It is a data or variable on which the operation is to be performed. Types of Operator ⇒Arithmetic Operators ⇒Relational Operators ⇒Logical Operators ⇒Assignment Operators ⇒Bitwise Operators ⇒Increment/Decrement Operators ⇒Conditional Operators ⇒Special Operator Arithmetic Operators Symbol Operation Example + Addition x+y - Subtraction x-y * Multiplication x*y / Division x/y % Modulus x%y #include<iostream> using namespace std; int main () { int a =5 ,b =3 ; cout << (a + b) << " \n " ; cout << (a - b) << " \n " ; cout << (a * b) << " \n " ; cout << (a / b) << " \n " ; cout << (a % b) << " \n " ; //%(modulus) holds remainder } /* ### Output ### 8 2 15 1 2 */ Relational operator Symbol ...

Storage class in c++

Image
Storage class A storage classes in c++ defines the  scope,liftime,default initial value  and  storage space  of a variable. There are four storage classes in c++ 1.automatic. 2.static. 3.register. 4.external.                 Automatic: storage class 1.Automatic variables are declared inside a function in which they have to used. 2.When the function is called automatic variables are created and destroyed when function is exited. 3.Automatic variables can not be used outside that function in which it is declared it means we can say that it is private member. 4.Automatic variables are also known as local variable. 5. auto  keyword is used to declare automatic type variable. Features of automatic variable Storage Memory Default Initial Value Garbage Value(Unpredictable value) Life Till the control remains within the function in which it is defined Scope Local to the function in which auto v...

Data type in c++.

Image
      Data type A data type  or simply type  is an attribute of data  which tells the compiler or   interpreter  how the programmer intends to use the data. Most programming languages support basic data types of integer  numbers of varying sizes floating point  numbers (which approximate real numbers characters  and boolen . A data type constrains the values that an expression , such as a variable or a function, might take. This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored. A data type provides a set of values from which an expression  (i.e. variable, function, etc.)

Constant and keyword in c++

Image
                  Constant An element of program whose value can not be change at the time  of execution of program is called constant. It is also called literals.               It's may be ,int,float,double and character data type. Rule of constructing integer constant It's must have atleast one digit. It's must not have a decimal point. It's must be positive or negative. The range of integer constant is between -32768 to +32767. No comma and blank space are allowed in integer constant.       Rule of constructing  floating constant It's must have atleast one digit. It's must have a decimal point. It's must be positive or negative. No comma and blank space are allowed in floating constant. Rule of constructing character constant It is a single alphabet,digit and special simbol. The length of character constant is 1 character. character const...

Variable of c++

Image
              Variable                  Defination:-                       It is a name of storage space which is use to store data. Its value is changeable. It's always value contain last value stored to it. It is always declared with data type. Variable of c++                  Variable declaration int no;                                                                  float percentage;                                               char grade;                  ...

Syntax of c++ program

syntax of c++ #include<iostream.h> #include<conio.h> Void main() { clrscr(); cout<<"hello word "; getch(); } #.                                                    1.Iti called preprocessor. 2.It is include the library of c++ into the program before the exicution. Include.                                        To Include the header file into the program. Iostream.                                     Its stands for input output stream. It is a collection of predefined function. It is also called library of c++. Conio.                            ...

What is c++.

Image
                   C++notes what is c++ Basic c++ is an objective-oriented programing language. It is a (++) version of C.  C++ use of allows> procedural programming for intensive functions of CPU and to provide control over hardware, and this language is very fast because of which it is widely used in developing different games or in gaming engines. C++ developing the suites of a game tool. Features of c++ language Simple Powerful Portable Machine indipendent Structure oriented High level programing Application of c++ language developing game operating system compiler database system Editors graphic package syntax of c++ #include<iostream.h> #include<conio.h> Void main() { clrscr(); cout<<"hello word "; getch(); } #.                                    ...