V

@vanshu_179

dynamic memory allocations

C++
3 years ago
#include <iostream> using namespace std; int main() { int size; int *ptr; cout<<"enter no. of values:"<<endl; cin>>size; ptr=new int(size);

abstraction

C++
3 years ago
#include <iostream> using namespace std; class abstraction{ private: int a,b; public: void set(int x, int y){ a=x;

encapsulation using get function

C++
3 years ago
#include <iostream> using namespace std; class encapsulation{ private: int x; public: void set(int a){ x=a; }

encapsulation

C++
3 years ago
#include <iostream> using namespace std; class student{ private: int rollno; string name; int age; public: void getdetails(){

Encapsulation

C++
3 years ago
#include <iostream> using namespace std; class A{ private: int a,b; public: void show(){ cout<<"enter value";

virtual functions

C++
3 years ago
#include <iostream> using namespace std; class base{ public: virtual void print(){ cout<<"this is the base class print function "<<endl; } virtual void display(){ cout<<"this is the base class display function "<<endl;

operator overloiading (addn of 2 complex no.)

C++
3 years ago
#include <iostream> using namespace std; class complex{ private: int real,img; public: complex(int r=0,int i=0){ real=r; img=i;

destructor, 3 types of constructors in class

C++
3 years ago
#include <iostream> using namespace std; class student { public: string name; int age; bool gender;

class

C++
3 years ago
#include <iostream> using namespace std; class student { public: string name; int age; bool gender; void printInfo(){

Viral advertisement hackerrank que

C++
3 years ago
#include <iostream> using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; cin>>n;

Function overloading

C++
3 years ago
#include <iostream> using namespace std; void sum(int,int); void sum(int); int main() { int a,b; sum( a, b); sum(4); return 0;

Implicit and explicit type casting

C++
3 years ago
#include <iostream> using namespace std; int main() { float x = 10.3; int y = int(x); int d = 7; float z= x+d ; cout<<"the value of z is:"<<z<<endl; cout<<"the value of y is:"<<y<<endl;

Implicit type casting

C++
3 years ago
#include <iostream> using namespace std; int main() { float x= 10.0; int y= int (x); cout<<"the value of y is: "<<y; return 0; }

Virtual inheritance

C++
3 years ago
#include <iostream> using namespace std; class A{ public: void show() { cout << "Hello form A \n";

Char to int type casting

C
3 years ago
#include <iostream> using namespace std; int main() { char y= 'a'; int x= char(y); cout<<"the value of x is:"<<x; return 0; }

Explicit type casting

C++
3 years ago
#include <iostream> using namespace std; int main() { float x= 10.3; int y= 5; float a = x+y; cout<<"the value of a is: "<<a; return 0; }

Factorial in c++

C++
3 years ago
#include <iostream> using namespace std; int fact(int n); int main() { printf("factorial is %d\n",fact(7)); return 0; } int fact(int n){

structure for students data

C
3 years ago
#include <stdio.h> #include<string.h> struct student { int roll; float cgpa; char name[50]; }; int main() {

check if given ch is present in a string or not

C
3 years ago
#include <stdio.h> void checkch(char str[50],char ch); int main() { char str[]="vanshikasingla"; char ch='b'; checkch(str[],ch); } void checkch(char str[],char ch){

function to count the occurence of vowels in a string

C
3 years ago
#include<stdio.h> int countvowels(char str[]); int main() { char str[]="hello world"; printf("vowels are : %d",countvowels(str)); } int countvowels(char str[]){ int count=0;