33
Total Posts
3
Categories
24/7
Updated

C++

Explore curated C++ resources and snippets.

Write a program to find the matrix inversion by using Gauss-elimination method / Gauss Seidel method.

Input Enter order of matrix (n): 2Enter elements of matrix:2 15 3 Output Inverse Matrix is:3   -1-5  2 &nb...

Code Snippet

Write a program to find the numerical solution of Differential equations by using Runge Kutta method / Euler method.

Output Using Euler Methodx       y0       10.1     1.10.2     1.220.3 ...

Code Snippet

Write a program to find the value of numerical integration by using/ Trapezoidal Rule/ Simpson’s one-third rule/ Simpson’s 3/8 rule.

Input Choose Method:1. Trapezoidal Rule2. Simpson's 1/3 Rule3. Simpson's 3/8 RuleEnter choice: 2Enter lower limit a and...

Code Snippet

Write a program to find f(x) by using Lagrange Interpolation/ Newtonian Interpolation.

Input Enter number of data points: 4Enter x values:1 2 3 4Enter corresponding y values:1 8 27 64Enter value of x to fin...

Code Snippet

Write a program to determine the roots by using Bisection Method / Regula-Falsi Method / Newton Raphson Method.

Input Choose Method:1. Bisection Method2. Regula-Falsi Method3. Newton-Raphson MethodEnter choice: 1Enter initial guess...

Code Snippet

Write a program to generate the Fibonacci sequence using recursion and find the number that are perfect square.

Input Enter number of terms: 10 Output Fibonacci Series:0 1 1 2 3 5 8 13 21 34 Number of Fibonacci numbers that are ...

Code Snippet

Write a program to construct a magic square of dimension n Γ— n (n odd).

Input Enter an odd number (n):  3 Output Magic Square of size 3 × 3:8   1   63   5   7...

Code Snippet

Write a program to multiply two numbers having more than 15 digits each.

Input Enter first large number: 123456789123456Enter second large number: 987654321987654 OutputProduct: 1219326313565...

Code Snippet

Test the truth of Bertrand conjecture (Bertrand conjecture is that there is at least one prime between n and 2n).

Input Enter value of n (n > 1): 10 OutputPrime numbers between 10 and 20 are:11 13 17 19Bertrand conjecture is TRUE...

Code Snippet

Write a C++ program to use pointer for both base and derived classes and call the member function. Use Virtual keyword.

Output This is Derived class show() function -------------------------------------------------------------------------...

Code Snippet

Write a C++ program to create an array of pointers. Invoke functions using array objects.

Output Student Details:Roll Number: 100Roll Number: 101Roll Number: 102     Student *ptr[3] → arr...

Code Snippet

Write a C++ program to create multilevel inheritance. (Hint: Classes A1, A2, A3).

Output This is class A1This is class A2This is class A3   Explanation Multilevel inheritance occurs when a ...

Code Snippet

Write a C++ program to allocate memory using new operator.

Output Value stored in dynamically allocated memory: 25   Important Points new allocates memory at runtime ...

Code Snippet

Write a C++ program to use scope resolution operator. Display the various values of the same variables declared at different scope levels.

Output Local x       = 10Class x       = 50Global x      = 100   ...

Code Snippet

Write a C++ to illustrate the concepts of console I/O operations.

Input Enter your name: Rahul KumarEnter your age: 20Enter your marks: 85.5   Output ---- Student Details ----Na...

Code Snippet

Write a C++ program to read the data of N employee and compute Net salary of each employee (DA=52% of Basic and Income Tax (IT) =30% of the gross salary).

Input Enter number of employees: 2 Enter details of Employee 1Enter Employee Number: 101Enter Employee Name: RahulEnte...

Code Snippet

Given that an EMPLOYEE class contains following members: data members: Employee number, Employee name, Basic, DA, IT, Net Salary and print data members.

Input Enter Employee Number: 101Enter Employee Name: Amit KumarEnter Basic Salary: 20000Enter DA: 5000Enter IT: 2000 &...

Code Snippet

Write a C++ program to declare a class. Declare pointer to class. Initialize and display the contents of the class member.

Output Roll No: 101 Grade: A Important Points (For Exams) A pointer to class stores the address of an ob...

Code Snippet

Write a C++ program to declare Struct. Initialize and display the contents of member variables

Output   Student DetailsRoll No: 101Name: RahulGrade: A     struct is used to group different data...

Code Snippet

Write a C++ program to display Names, Roll No., and grades of 3 students who have appeared in the examination. Declare the class of name, Roll No. And grade. Create array of class objects. Read and display the contents of the array.

A class Student is declared with: name rollNo grade An array of class objects is created for...

Code Snippet

Hello World in C++

#include <iostream>: This is a preprocessor directive that includes the iostream (input/output strea...

Code Snippet