Friday, 22 December 2017

Concept of C++ In Program


#include<iostream>

#include<conio.h>

using namespace std;

void starline();

class CPP

   {

                public:

                                void show_menu1()

                                {

                                                int ch;

                                                previous:

                                                cout<<"\t\t<-----Concept of C++ Programming----->\n\n1: Introduction of C++\n2: Constants and Variables\n3: Algorithm, Flow  Chart and Pseudocode\n4: If_Statement and If...else Statement\n5: Loops ----While Loop and For Loop\n6: Functions\n7: Switch Statement\n8: Arrays \n9: String\n10: File Handling\n11: Exit\n\n\t\t\tEnter your Choice:- ";

                                                cin>>ch;

                                                switch(ch)

                                                {

                                                                case 1:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tIntroduction\n\nC++ is a programming language developed in 1980 by Bjarne Stroustrup at the Bell Telephone Laboratories. C++ is object oriented programming language and it is a very simple and easy language, this language have following features:\nSimple\nPortability\nPowerful\nPlatform dependent\nObject oriented\nCase sensitive\nCompiler based\nSyntax based language";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;

                                                                                break;

                                                                case 2:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tConstant\n\nConstant is an identifier whose value can not be changed at the execution time of program. In general constant can be used to represent as fixed values in a C++ program.\n\n\n\t\t\t\tVariable\n\nVariable is an identifier which holds data or another one variable is an identifier whose value can be changed at the execution time of program. Variable is an identifier which can be used to identify input data in a program.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;

                                                                                break;

                                                                case 3:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tAlgorithm\n\nThe solution to any computing problem involves executing a series of actions in a specific order. A procedure for solving a problem in terms of\n\t1. the actions to be executed\n\t2. the order in which these actions are to be executed\nis called an algorithm.\n\n\n\t\t\t\tPseudocode\n\nPseudocode is an artificial and informal language that helps you develop algorithms. Pseudocode is similar to everyday English; it?s convenient and user friendly although it?s not an computer programming language.\n\n\n\t\t\t\tFlow Chart\n\nA flowchart is a graphical representation of an algorithm or of a portion of an algorithm. Flowcharts are drawn using certain special-purpose symbols such as rectangles,diamonds,rectaingles,and small circles connected by flowlines.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;  

                                                                                break;

                                                                case 4:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tIf-Statement\n\nIf-Statement  is most basic statement of Decision making statement. It tells to program to execute a certain part of code only if particular condition or test is true.If the body is not specified, then automatically condition part will be terminated with next semicolon ( ; ).\n\n\n\t\t\t\tIf...Else Statement\n\nIn general it can be used to execute one block of statement among two blocks, in C++ language if and else are the keyword in C++.whenever condition is true all the if block statement are executed remaining statement of the program by neglecting else block statement. If the condition is false else block statement remaining statement of the program are executed by neglecting if block statements.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;  

                                                                                break;

                                                                case 5:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\t Loops\nSet of instructions given to the compiler to execute set of statements until condition becomes false is called loops. The basic purpose of loop is code repetition that means same code repeated again and again. \nThere are three type of Loops available in 'C' programming language.\n\t1: while loop\n\t2: for loop3: \n\t3:do-while \n\n\t\t\t\tWhile Loop\nIn while loop First check the condition if condition is true then control goes inside the loop body other wise goes outside the body.  If while loop condition never false then loop become infinite loop.\n\n\t\t\t\tFor Loop\nWhen you need to execute a block of code several number of times then you need to use looping concept in C++ language. In C++ Programming Language for loop is a statement which allows code to be repeatedly executed. For loop contains 3 parts whic are Initialization, Condition and Increment or Decrements\n\n\t\t\t\tDo While loop\nA do-while loop is similar to a while loop, except that a do-while loop is execute at least one time. A do while loop is a control flow statement that executes a block of code at least once, and then repeatedly executes the block, or not, depending on a given condition at the end of the block (in while).";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;  

                                                                                break;

                                                                case 6:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tFunctions in C++\n\n\nA function is a group of statements that together perform a specific task. Every C++ program has at least one function, which is main().\nFunction are used for divide a large code into module, due to this we can easily debug and maintain the code. For example if we write a calculator programs at that time we can write every logic in a separate function (For addition sum(), for subtraction sub()). Any function can be called many times.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;  

                                                                                break;

                                                                case 7:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tSwitch Statement in c++\n\nThe switch statement in C++ language is used to execute the code from multiple conditions or case. It is same like if else-if ladder statement. A switch statement work with byte, short, char and int primitive data type, it also works with enumerated types and string but not with float.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;  

                                                                                break;

                                                                case 8:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tArrays\n\nAn array is a collection of similar data type value in a single variable. It is a derived data type in C++, which is constructed from fundamental data type of C++ language. To declare an array in C++ required type of array elements and size of array. Initializing is a process to initialize the value in array variable. We can access array elements with the help of index value of element.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;

                                                                                break;

                                                                case 9:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tString in C++\n\nString is a collection of character or group of character, it is achieve in C language by using array character. The string in C language is one-dimensional array of character which is terminated by a null character '\0'. In other words string is a collection of character which is enclose between double cotes ( " " ).\n\nNote: Strings are always enclosed within double quotes. Whereas, character is enclosed within single quotes in C.\n\nIn declaration of string size must be required to mention otherwise it gives an error.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;

                                                                                break;

                                                                case 10:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tFile Handling\n\nFile Handling concept in C++ language is used for store a data permanently in computer. Using file handling we can store our data in Secondary memory (Hard disk).";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto previous;

                                                                                break;

                                                                case 11:

                                                                                system("cls");

                                                                                cout<<"Thank you , bye bye";

                                                                                exit(0);

                                                                                break;

                                                                default:

                                                                                system("cls");

                                                                                goto previous;

                                                                                break;

                                                }

                                }

};

class OOP

{

                public:

                void show()

                                {

                                int c;

                                                back:

                                                cout<<"\t<-----Concept of Object Oriented Programming Using C++----->\n\n1: Introduction of OOP\n2: Structures\n3: Objects and Classes\n4: Operator Overloading\n5: Inheritance\n6: Polymorphism\n7: Exception\n8: Reusability\n9: Data Abstraction and Data Encapsulation\n10: Exit\n\n\t\t\tEnter your Choice:- ";

                                                cin>>c;

                                                switch(c)

                                                {

                                                                case 1:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tIntroduction of OOP\n\nObject-Oriented Programming (OOP) is the term used to describe a programming approach based on objects and classes. The object-oriented paradigm allows us to organise software as a collection of objects that consist of both data and behaviour.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;

                                                                                break;

                                                                case 2:

                                                                                system("cls");

                                                                cout<<"\t\t\t\tStructures\n\nStructures can be defined as a tool for handling a group of logically related data items";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;

                                                                                break;

                                                                case 3:

                                                                                system("cls");

                                                                cout<<"\t\t\t\tObjects and Classes\n\nIn object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods).";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;          

                                                                                break;

                                                                case 4:

                                                                                system("cls");

                                cout<<"\t\t\t\tOperator Overloading\n\nIn programming, operator overloading, sometimes termed operator ad hoc polymorphism, is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading is generally defined by a programming language, a programmer, or both.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;          

                                                                                break;

                                                                case 5:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tInheritance\n\nIn object-oriented programming, inheritance enables new objects to take on the properties of existing objects. A class that is used as the basis for inheritance is called a superclass or base class. A class that inherits from a superclass is called a subclass or derived class.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;          

                                                                                break;

                                                                case 6:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tPolymorphism\n\nIn object-oriented programming, polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;          

                                                                                break;

                                                                case 7:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tException\n\nAn exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;          

                                                                                break;

                                                                case 8:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tReusability\n\nReusabiliry is the ability of a system to be reused, in whole or in parts, for.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;

                                                                                break;

                                                                case 9:

                                                                                system("cls");

                                                                                cout<<"\t\t\t\tData Abstraction and Data Encapsulation\n\nEncapsulation is wrapping, just hiding properties and methods. Encapsulation is used for hide the code and data in a single unit to protect the data from the outside the world. Class is the best example of encapsulation. Abstraction refers to showing only the necessary details to the intended.";

                                                                                cout<<"\n\nPress Any key to goto previous menu"<<endl;

                                                                                getch();

                                                                                system("cls");

                                                                                goto back;

                                                                                break;

                                                                case 10:

                                                                                system("cls");

                                                                                cout<<"Thank you , bye bye";

                                                                                exit(0);

                                                                                break;

                                                                default:

                                                                                system("cls");

                                                                                goto back;

                                                                                break;  

                                }

                }

};

main()

{

                int choice;

                main:

                                starline();

                                cout<<"WELCOMEEE TOOO THE WORLD OF PROGRAMMING";

                                starline();

                                cout<<endl;

                                starline();

                                cout<<"Project";

                                starline();

                                cout<<endl;

                                starline();

                                cout<<"Concept Of CPP";

                                starline();

                                cout<<endl;

                                starline();

                                cout<<"Dua Rafiq";

                                starline();

                                cout<<endl;

                                starline();

                                cout<<"Muntaha Majid";

                                starline();

                                cout<<endl;

                                starline();

                                cout<<"Iqra Iman";

                                starline();

                                cout<<endl;

                                starline();

                                cout<<"Submitted To Mam Anika";

                                starline();

                                cout<<endl;

                cout<<"\n\n\n\tMenu:\n\t\t1: Concept of C++ Programming\n\t\t2: Concept of Object Oriented Programming (OOP) using C++\n\t\t3: Exit";

                cout<<"\n\n\t\t\tPlease Select Any Number:-";

                cin>>choice;

                switch(choice)

                {

                                case 1:

                                                system("cls");

                                                CPP obj;

                                                obj.show_menu1();

                                                break;

                                case 2:

                                                system("cls");

                                                OOP obj1;

                                                obj1.show();

                                                break;

                                case 3:

                                                system("cls");

                                                cout<<"Thank You"<<endl;

                                                exit(0);

                                                break;

                                default:

                                                system("cls");

                                                goto main;

                                                break;

                }

}

void starline()

{

                for(int j=0;j<5;j++)

                {

                                cout<<'*';

                }

               

}

1 comments:

  1. Are you looking to enhance your programming skills and gain expertise in C and C++? Look no further than APTRON Solutions in Delhi. Our comprehensive C C++ Training in Delhi is designed to equip you with the knowledge and skills necessary to excel in the world of software development.

    ReplyDelete

Tech UOG