Print Sum Of Variable and Number
Program Info
Program Code
×

Print Sum Of Variable and Number

we are doing print sum of variable and numbers with the help of addition operator.

Footer

×

Print Sum Of Variable and Number

#include <iostream>
using namespace std;

int main() {
  int sum1 = 100 + 50;        // 150 (100 + 50)
  int sum2 = sum1 + 250;      // 400 (150 + 250)
  int sum3 = sum2 + sum2;     // 800 (400 + 400)
  cout << sum1 << "\n";
  cout << sum2 << "\n";
  cout << sum3;
  return 0;
}

Footer

Print Sum Of Two Numbers
Program Info
Program Code
×

Print Sum Of Two Numbers

we are doing print sum of two numbers with the help of addition operator.

Footer

×

Print Sum Of Two Numbers

#include <iostream>
using namespace std;

int main() {
  int x = 100 + 50;
  cout << x;
  return 0;
}

Footer

Create an Object of Class
Program Info
Program Code
×

Create an Object of Class

We are doing create an object of class then called constructor automatically

Footer

×

Create an Object of Class

#include <iostream>
using namespace std;

class MyClass {     // The class
  public:           // Access specifier
    MyClass() {     // Constructor
      cout << "Hello World!";
    }
};

int main() {
  MyClass myObj;    // Create an object of MyClass (this will call the constructor)
  return 0;
}

Footer

Comparision of Two Numbers
Program Info
Program Code
×

Comparision of Two Numbers

We are doing compare two integers numbers and print result of its.

Footer

×

Comparision of Two Numbers

#include <iostream>
using namespace std;

int main() {
  cout << (10 == 15);
  return 0;
}

Footer

Call an Function
Program Info
Program Code
×

Call an Function

We are doing call an function with multiple times.

Footer

×

Call an Function

#include <iostream>
using namespace std;

void myFunction() {
  cout << "I just got executed!\n";
}

int main() {
  myFunction();
  myFunction();
  myFunction();
  return 0;
}

Footer

Access and Modify Attribute of Class
Program Info
Program Code
×

Access and Modify Attribute of Class

We are doing access attributes of class and then modify it.

Footer

×

Access and Modify Attribute of Class

#include <iostream>
using namespace std;

class MyClass {   // The class
  public:         // Public access specifier
    int x;        // Public attribute (int variable)
};

int main() {
  MyClass myObj;  // Create an object of MyClass

  // Access attributes and set values
  myObj.x = 15;

  // Print values
  cout << myObj.x;
  return 0;
}

Footer


×

Name : Krishna Verma    |    Father's Name : Mr. Satish Kumar    |    Email ID : krishnaverma28081997@gmail.com    |    Religion : Hindu    |    Address : Dayampur, kanker khera, Meerut Cantt (250001), UP    |    Date of Birth : 28 August 1997    |    Marital Status : Non-Married    |    Place of Birth : Dayampur Kanker Khera Meerut Cantt.    |    Gender : Male    |    Age : 28    |    Contact : 9520335394    |    Father's Occupation : Sports man    |    Mother's Name : Smt. Kuntesh Devi    |    Mother's Occupation : Homemaker    |    Number of Brothers : 1    |    Number of Sisters : 1    |    Current Residence : Dayampur kanker khera meerut cantt    |    Family Type : Nuclear Family    |    Family Name : verma    |    Height : 5' 6''    |    Weight : 70 kg    |    Complexion : Fair    |    Body Type : Athletic    |    Hair Color : Black    |    Health Status : Good    |    Any Physical Disability : No    |    Highest Qualification : B.Tech (CSE)    |    Master Skill : PHP Laravel    |    Total Projects : 40 +    |    Total Skills : 25 +    |    Languages Known : Hindi and English    |    Website : krishnaportfolio.in    |    Siblings : 3    |    Nationality : Indian    |    Total Experience : 5 Years    |    LinkedIn : https://www.linkedin.com/in/krishna-verma-840b71356/    |    Total Programs : 10000    |    Total Projects : 40    |    Total Skills : 25    |    Total Experience : 5    |    Total DSA Problems : 165    |    Total Served Companies : 2