Skip to main content

Posts

Showing posts from April, 2023

9. Jumps Statement in c++

➢ Jumps in Loops:- ➢ C++ break and continue Statement:-                     There are two statements (break; and continue ;) built in C++ programming to alter the normal flow of program.                     Loops are used to perform repetitive task until test expression is false but sometimes it is desirable to skip some statement/s inside loop or terminate the loop immediately with checking test condition. On these type of scenarios, continue; statement and break; statement is used respectively. The break; statement is also used to terminate switch statement. 1) break Statement :-                       The break; statement terminates the loop(for, while and do..while loop) and switch statement immediately when it appears . Syntax of break :- break;              ...

8. Looping Statement

  ➢ Looping Statement  :-                In computer programming, loop cause a certain piece of program to be executed a certain number of times. Consider these scenarios:                 • You want to execute some code/s certain number of time.                 • You want to execute some code/s certain number of times depending upon input from user.                 These types of task can be solved in programming using loops.                 There are 3 types of loops in C++ Programming:                                • for Loop                            ...

7. Switch Statement in c++

 ❖ C++ switch Statement :-                Consider a situation in which, only one block of code needs to be executed among many blocks. This type of situation can be handled using nested if...else statement but, the better way of handling this type of problem is using switch...case statement.  Syntax of switch:-      Switch(expression) {            Case value1 : statement1;                       Break;             Case value2 : statement2;                      Break;             Default : default statements;  }               The expression is either an integer or a character in above syntax. If the expression matches constant in case, the relevant codes a...

6. Conditional Statements

●  Conditional Statements:-                 The if, if...else and nested if...else statement are used to make one-time decisions in C++ Programming, that is, to execute some code/s and ignore some code/s depending upon the test condition. Without decision making, the program runs in similar way every time. Decision making is an important feature of every programming language using C++ programming.  1) Simple if Statement:-                 The if statement checks whether the test condition is true or not. If the test condition is true, it executes the code/s inside the body of if statement. But it the test condition is false, it skips the code/s inside the body of if statement.  Structure of if Statement:-   if (Boolean Expresson)  {  /* if Expression is true */  Statements;  }  ●  Flowchart of if :- Example program:- #include  <iostream.h...

5. Operator of c++

  Operators:-               An operator is a symbol that tells the compiler to perform specific mathematical operation or logical manipulations. C++ provides the following type of operators. 1) Arithmetic Operators  2) Relational Operators  3) Logical Operators  4) Bitwise Operators  5) Assignment Operators  6) Misc Operators  1) Arithmatic Operators:-              There are following arithmetic operators supported by c++ language. Assume variable A holds 10 and variable b holds 20 then, Operator Description Example + Adds two operands A+B will give 30 - Subtracts second operand from the first A - B will give -10 * Multiplies both operands A * B will give 200 / Divid...

4. Data types of c++

  •  Data Types :-                While writing program in any language, you need to use various variables to store various information. Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. The following table shows the variable type, how much memory it takes to store the value in memory, and what is maximum and minimum value which can be stored in such type of variables. •  Types of Data types:- 1.Primary (fundamental) data types.  2.Derived data types.  3.User-defined data types

3. Input /output in c++

  ➢   Input/ Output in C++ :-        C++ comes with libraries which provides us many ways for performing input and output. In C++.        input and output is performed in the form of sequence of bytes or more commonly known as  streams. ● Input Stream: If the direction of flow of bytes is from device(for example: Keyboard) to the main memory then this process is called input. ● Output Stream: If the direction of flow of bytes is opposite, i.e. from main memory to device(display screen ) then this process is called output. ● Header files available in C++ for Input – Output operation are: • iostream: iostream stands for standard input output stream. This header file contains definitions to objects like cin, cout, cerr etc. • fstream: This header file mainly describes the file stream. This header file is used to handle the data being read from a file as input or data being written into the file as output.       ...

2. Basic Structure of c++

  ● BASIC STRUCTURE OF C++ LANGUAGE :-          The program written in C++ language follows this basic structure. The sequence of sections should be as they are in the basic structure. A C program should have one or more sections but the sequence of sections is to be followed. 1. Documentation section 2. Linking section 3. Definition section 4. Global declaration section & class declarations 5.Member function definition 6. Main function section main() { Declaration section Executable section } 1. DOCUMENTATION SECTION :-        comes first and is used to document the use of logic or reasons in your program. It can be used to write the program's objective, developer and logic details. The Documentation is done in C language with /* and */ . Whatever is written between these two are called comments. 2. LINKING SECTION :-         This section tells the compiler to link the certain occurrences of keywords or function...

1.1 C++ with oops advantage

●   Advantage of OOPs over Procedure-oriented programming language :- 1. OOPs makes development and maintenance easier where as in Procedure-oriented programming language it is not easy to manage if code grows as project size grows. 2. OOPs provide data hiding whereas in Procedure-oriented programming language a global data can be accessed from anywhere. 3. OOPs provide ability to simulate real-world event much more effectively. We can provide the solution of real word problem if we are using the Object-Oriented Programming language. Previous Next

1. c++ concepts

  ★   c++ Oops concepts :-            The major purpose of C++ programming is to introduce the concept of object orientation to the C programming language.            Object Oriented Programming is a paradigm that provides many concepts such as inheritance, data binding, polymorphism etc.            The programming paradigm where everything is represented as an object is known as truly object-oriented programming language. Smalltalk is considered as the first truly objectoriented programming language. ★  Oops introduction :-           Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts: • Object • Class • Inheritance • Polymorphism • Abstraction • Encapsulation ● Object :-          Any entity that has s...

C++ programming language

                c++ is a general programming language and is widely used nowadays for competitive programming. It has imperative, object-oriented and generic programming features.C++ runs on lots of platforms like Windows, Linux, Unix, Mac etc.   ❖❖  C++ with oops ❖❖

Pratical -206 paper solution -3

Full course of c++ programming language Click here > C++ programming language Q-1 [A] Write a c program to create structure of employee with members Empid, EmpName, Qualification and EmpSalary by taking input of 5 employees display the employee whose qualification is "MBA" and salary greater than 20000 . #include <stdio.h> #include <conio.h> #include <string.h> struct Employee {     int Empid, EmpSalary;     char EmpName[50];     char Qualification[50]; }; Void main() {     struct Employee emp[5];     int i;     for (i = 0; i < 5; i++)     {         printf("Enter employee ID: ");         scanf("%d", &emp[i].Empid);         printf("Enter employee name: ");         scanf("%s", emp[i].EmpName);         printf("Enter employee qualification: ");         scanf("%s", emp[i].Quali...

Practical-206 paper solution

Q-1 [A] Write a Python program to print Fibonacci series up to n terms.  N=int(input('Enter a N : '))  A=0 B=1 for i in range(0, N) :         Print(A, end=' ')          C=A+B         A=B         B=C Q-1 [B] Write a program that creates structure of student with student id, name, percentage. Enter data of five students. Display data of those student whose percentage is less than 70 marks.  #include <stdio.h> #include <conio.h> struct Student {     int id, percentage;     char name[50]; }; void main() {     struct Student stu[5];     clrscr();     for (int i = 0; i < 5; i++)     {         printf("\nEnter data for student %d:\n", i + 1);         printf("Enter student ID: ");         scanf("%d", &stu[i].id);         printf("Enter studen...