Posts

Showing posts from February, 2021

Basics Of OOPS In C++ | Classes & Objects In C++

Image
 Basics Of OOPS In C++  What is Class? Class is like a form in programming. You know in a form you have some fields where every user fills that form. So the one form template can be filled by any user. The class can be assumed as a generalized set of programs whereas many objects can access the features of that class. You can understand class by this image easily:-  Here in this example, you can see a template of a car that can be accessed by many car companies like polo, mini, beetle etc. So here polo, mini, beetle are called objects which is an instance (user) of car class. A class may have data members (attributes) and methods (functions) like the structures you can understand this concept by this image -  So here car class has methods and attributes so the objects of this class should have access to these methods and attributes. Access Specifier In OOPS C++ -  public  - members are accessible from outside the class private  - members cannot be accessed (or viewed) from outside the

Structures in C++ | struct in cpp

  Structures in C++  What are structures in CPP? Structures are user-defined data types in CPP or you can say heterogeneous data types. As you know there are traditional (standard) data types in CPP for e.x. - int, char, float, etc. but structure is a container of one or more than one standard data type. For example, if we create a data type named " Student " then the " Student " data type may contain the " name " variable of char type, " roll_no " var of int type, " percentage " variable of float data type. You can protect your data members with three access specifier private - Data members & methods can access only in the class public - Data members & methods can access the program protected - Data members can access the child structure or clas But Remember, no function can be a part of either private or public specifier. Also, it is to be kept in mind there was a need for class, because of the concept of inheritance and func

Basic Of Of C++ Programming || Data Types, cout, cin, If-else, for, while in cpp | Math Table Generator In cpp

 Basic Of Of C++ Programming  Starter Template Of C++ : #include   < iostream >   //HEADER FILE using   namespace   std ; int   main ()  //MAIN FUNCTION WHICH RETURN TYPE IS INTEGER {     //WRITE STUFF HERE      return   0 ; } Data Types in C++: /* Data Type   Meaning                  Size (in Bytes) int         Integer                    2 or 4 float      Floating-point                4 double     Double Floating-point         8 char        Character                    1 wchar_t     Wide Character               2 bool        Boolean                      1 void        Empty                        0 */ How to Print In C++:- #include   < iostream >   //HEADER FILE using   namespace   std ; int   main ()  //MAIN FUNCTION WHICH RETURN TYPE IS INTEGER {      cout << " Hello India! " << endl ;  //cout is used to print some values      return   0 ; } Output -  Hello India! How to Take Input From User In C++:- #include   < iostream >   //HEADER FILE usin